Quantcast
Viewing latest article 20
Browse Latest Browse All 90

error:Object reference not set to an instance of an object

this is driving me crazy can anyone give me any help please. the error is online 37 in var childcam: Camera var rocketpref:Transform; var shoottimer: float = 0; var shootcooler: float = 0.9; function OnGUI() { if(shoottimer> 0){ shoottimer -=0.2* Time.deltaTime * 10; } if(shoottimer < 0){ shoottimer = 0; } //Fire button if (GUI.Button(Rect(450,280,80,80),"Rockets")) { if(shoottimer ==0){ var bullit = Instantiate(rocketpref, GameObject.Find("rs").transform.position, Quaternion.identity); shoottimer = shootcooler; } } if (GUI.Button(Rect(350,280,80,80),"cam")) { var childCam : Camera = bullit.GetComponentInChildren(Camera); childCam.enabled =false; } }

Viewing latest article 20
Browse Latest Browse All 90

Trending Articles