I am trying to run this piece of code but then i get an error.
“NullReferenceException
cutTree.Update () (at Assets/Character Controllers/Sources/PrototypeCharacter/Materials/cutTree.js:29)”
This is my code:
var bullitPrefab:Transform;
function Start () {
}
function Update () {
if(Input.GetButtonDown("placeLog")) {
if(Vector3.Distance(GameObject.Find("BigTree").transform.position, transform.position) < 5){
Destroy(GameObject.Find("BigTree"));
var bullit = Instantiate(bullitPrefab, GameObject.Find("logSpawn").transform.position, Quaternion.identity);
}
}
}
Can someone please help me?