Quantcast
Channel: Questions in topic: "error"
Viewing all articles
Browse latest Browse all 7934

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

$
0
0
I keep getting this error from my script, its not effecting the gameplay at all as far as i know, however it is getting annoying seeing it in the console every time i test using UnityEngine; using System.Collections; public class SpawnPointScript : MonoBehaviour { private Seeker seeker; private Transform player; public bool enablePlayerChecking; [HideInInspector] public bool canSpawn; private float cooldown; private float rateOfRefresh; private Vector3 lastPathNode; // Use this for initialization void Start () { rateOfRefresh = 0.5f; cooldown = 0; seeker = GetComponent(); player = GameObject.FindGameObjectWithTag("Player").GetComponent(); enablePlayerChecking = true; } // Update is called once per frame void Update () { Debug.Log("Start of update"); if (cooldown > 0) { cooldown -= Time.deltaTime; } if (cooldown <= 0) { seeker.StartPath(transform.position, player.position); ***lastPathNode = seeker.lastCompletedVectorPath[seeker.lastCompletedVectorPath.Count - 1];*** float dist = Vector3.Distance(lastPathNode, player.position); if (dist <= 3) { Debug.Log("Path returns true"); canSpawn = true; }else { Debug.Log("Path returns null"); canSpawn = false; } cooldown = rateOfRefresh; } } } the error is specifically coming from line 44 thanks in advance EDIT: NullReferenceException: Object reference not set to an instance of an object SpawnPointScript.Update () (at Assets/Scripts/Evironment Scripts/SpawnPointScript.cs:44) thats the error

Viewing all articles
Browse latest Browse all 7934

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>