- Home /
 
               Question by 
               sdav · Mar 01, 2014 at 06:55 PM · 
                instantiatenullreferenceexception  
              
 
              Naming an instantiated gameobject gives nullreferenceexception.
Hi, I'm probably missing something simple here but I have this code:
  GameObject gBeast;
     gBeast = Instantiate(objBeast, new Vector3(0,0,0),Quaternion.identity) as GameObject;
     gBeast.name = "newname";
This is in the Start method of another game object.
When I try to name it I get a NullReferenceException. Can anyone help. Thanks
               Comment
              
 
               
              The code here looks fine. 'objBeast' should be a GameObject and the value should be non-null.
I think you have not assign objBeast . please check objBeast is Gameobject.
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                