Question by
ronJohnJr · Nov 10, 2021 at 03:30 PM ·
c#instantiateprefabsobjects
Instantiate prefab from folder, not scene
Hi, I have cars that get loaded into my scene dynamically. The cars have a script that will instantiate an object when I press E. This object is not in the scene though, it's in my assets.
I did some reading and I found I can click my script and then in the inspector drag my prefab into where it needs to go. But when the cars spawn, the script doesn't have the prefab I dragged into there, even though it shows it's there in my folder. I attached a picture, thanks.
unity-question.png
(97.5 kB)
Comment
I have cars that get loaded into my scene dynamically
How are they loaded?
If you use a prefab, make sure the references on the prefab are there