If anyone can help me with this, please no, that you have saved my life because I’m about to either A) have a heart attack or B) put a bullet in my brain.
I’m am getting the following message:
NullReferenceException: Object reference not set to an instance of an object
LaserFire.Update () (at Assets/Scripts/LaserFire.js:37)
//Oringal srcipt from tornadow twins
/*
var bullitPrefab : Transform;
function Update ()
{
if(Input.GetButtonDown("Jump"))
var bullit = Instantiate(bullitPrefab, gameObject.Find("spawnPoint").transform.position,Quaternion.identity);
bullit.rigidbody.AddForce(transform.forward * 200);
}
*/
//Copy from orginal: Changed var names from "bullit" to "laserBeamPrefab," and "laserbeam."
var laserBeamPrefab : Transform;
function Update ()
{
if(Input.GetButtonDown("Jump"))
var laserBeam = Instantiate(laserBeamPrefab, GameObject.Find("spawnPoint").transform.position,Quaternion.identity);
laserBeam.rigidbody.AddForce(Vector3.forward * 200);
}
“laserBeam” is an instance of a prefab. the “spawnPoint” is a Sphere. Please note: Everything works great! I just cant for the life of me figure out how to get rid of this god damn error message ![]()