Get 25% off your next order from the Unity Asset Store: YW86GYBU8S.
Forum begins after the advertisement:
[Part 4] cant add weapon prefab to scriptableobject
Home › Forums › Video Game Tutorial Series › Creating a Rogue-like Shoot-em Up in Unity › [Part 4] cant add weapon prefab to scriptableobject
- This topic has 12 replies, 2 voices, and was last updated 1 year, 9 months ago by
Ales V.
-
AuthorPosts
-
January 18, 2024 at 3:05 am #13118January 18, 2024 at 4:53 pm #13119::
Hi Ales, you don’t assign the
WeaponScriptableObjectto the field.You need to create a prefab that contains theYou need to assign the prefab of the projectile that the weapon spawns there.GarlicControllerscript, then assign the prefab to the field.Let me know if this clarifies your question.
January 19, 2024 at 12:20 am #13120::You mean this? https://imgur.com/a/09LaPnq If yes than its there from the start that was not the issue.
January 19, 2024 at 1:06 am #13121::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
January 19, 2024 at 2:31 am #13122::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
January 19, 2024 at 2:34 am #13123::Are you sure you are assigning the projectile prefab? In your video it looks like you are assigning the weapon scriptable object file.
January 19, 2024 at 2:45 am #13124::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
January 19, 2024 at 10:54 am #13126::Try dragging the prefab from the Project window instead. Let me know if you still get the same issue doing that.
January 19, 2024 at 11:59 pm #13128January 20, 2024 at 12:57 am #13129::Can you show me a screenshot of the Inspector properties of the prefab you’re dragging in?
January 20, 2024 at 6:05 am #13130January 21, 2024 at 12:02 am #13132::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.
January 21, 2024 at 12:04 am #13133 -
AuthorPosts
- You must be logged in to reply to this topic.
Advertisement below: