|
Trying to call Instantiate from within a function in a class. Here's what it looks like: The error I get is: "NullReferenceException: Object reference not set to an instance of an object." If I call Instantiate outside of the class (as part of an OnMouseDown function in another file) it works fine.
(comments are locked)
|
|
You don't need to use 'Object' as a prefix. IE... http://unity3d.com/support/documentation/ScriptReference/Object.Instantiate.html It's okay to do so. That's not the source of his error.
Aug 11 '11 at 12:31 PM
sneftel
(comments are locked)
|

Fixed my problem. The correct Instantiate line should read:
UnityEngine.Object.Instantiate(Resources.Load("t_obj"), Vector3(10.0, 20.0, 100.0), Quaternion.identity);
Working as it should now.