Question by
ribizlee11 · Mar 06, 2019 at 12:09 AM ·
instantiateprefab
Why am I unable to Instantiate a single cube from script?
I get this Exception all the time.
Here's my code.
So the problems occurs with the greenCube, I want to Instantiate it, but it keeps crashing, because it's "null". I dragged a simple cube in inspector to the script. I even tried to get the prefab instance from code, but it didn't work either. How can I solve this?
Comment
The error says it all. greenCube
is null.
Use Debug.Log( greenCube, this );
before calling Instantiate
so that, when you click on the error message, you will see which script is incorrectly set up.
Your answer

Follow this Question
Related Questions
Changing rotation of prefab 0 Answers
Instantiating prefabs, and making them move. (Projectiles) 0 Answers
Find instantiated prefab by name 3 Answers
Arrows fire in reverse. 1 Answer