Forum begins after the advertisement:
-
::here is the problem and code
View post on imgur.com
::Hi Ales, you don’t assign the WeaponScriptableObject
to the field. You need to create a prefab that contains the GarlicController
script, then assign the prefab to the field. You need to assign the prefab of the projectile that the weapon spawns there.
Let me know if this clarifies your question.
::You mean this? https://imgur.com/a/09LaPnq If yes than its there from the start that was not the issue.
::Ales, my bad. I meant you need to assign the prefab for the projectile onto the field, not the controller. Something like this:
You can look at the section above (3) in the article: https://blog.terresquall.com/2022/12/creating-a-rogue-like-vampire-survivors-part-4#creating-enemy-stats
::I know but when i try to add it there i didnt see it i can only add prefab from scene and when i tried that there where the problem come out it write there Type mismatch https://imgur.com/a/ar4sN9U and i dont know how to fix that
::Are you sure you are assigning the projectile prefab? In your video it looks like you are assigning the weapon scriptable object file.
::I open up the Garlic Weapon (weapon Scriptable Object) than i click on the thing next to prefab and this will pop up. I can only add things from scene and when i add garlic weapon to scene and than i will put it there it will type type mismatch. This is what i see when i am putting things in the space(or how its called in English its right next to prefab text in the inspector). https://imgur.com/a/Ak8fhon
::Try dragging the prefab from the Project window instead. Let me know if you still get the same issue doing that.
::Can you show me a screenshot of the Inspector properties of the prefab you’re dragging in?
::Here you go this is my garlic weapon prefab https://imgur.com/g2UakED
::Ales, are you dragging the Garlic Weapon in from the Hierarchy? Did you prefab your Garlic Weapon GameObject before dragging it into the box?
If you already have a prefab copy of it, don’t select it using the poup. Drag the prefab from the project window into the field. If it is in a different folder, you can lock the Inspector after selecting the Weapon Scriptable Object first, then navigate to the folder containing your prefab. Below is a picture of where the lock icon is.
::It works thank you very much for your help and time.
Advertisement below: