NullReferenceException: The prefab you want to instantiate is null.
I’ve been working with Unity3D for maybe 4 cumulative hours now and already I’ve frustratingly learned the same simple lesson twice. I have a little scripts that makes my camera shoot a cube whenever I clicked the left mouse button. In order to make that work I need to set the value of a variable from within the editor UI. But, when I select the script in the Project pane and then set those values in the Inspector pane, I still the error above.
That’s because in the Unity editor even scripts have instances made of them, which is an understandable but foreign concept to me. So, as you’ll see in the screenshot, you need to select the object in your scene to which you’ve previously applied your script (Main Camera here) and edit the variables’ values for that instance of the script.
You may select the script itself in the Project pane and it will allow you to set the values of the variables the same way, but it won’t work. That being the case, I’m actually not sure why it’s possible to do it here as well. Perhaps if I had set the values before applying the script to the object. I don’t know, suppose I’ll learn soon enough.
Oh, and here’s a forum post about this topic: