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

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

$
0
0
I have a Game Object ghostBuddy (with a collider) with script GhostBuddy.cs as here: using UnityEngine; using System.Collections; namespace GameScripts.BalloonBalance { public class GhostBuddy : MonoBehaviour { public bool isInsideGhost = false; void OnTriggerEnter2D (Collider2D other) { if (other.gameObject.GetComponent() || other.gameObject.GetComponent()) { isInsideGhost = true; } } } } and I am trying to check from the game manager if isInside Ghost is true , by setting: public GameObject ghostBuddy; void Awake() { ghostBuddy = (GameObject)Instantiate (Resources.Load ("Prefabs/GhostBuddy")); } void FixedUpdate () { currentPoolSize = pool.Count; if (shouldIDraw) { if ((ghostBuddy.GetComponent () != null)) { if (ghostBuddy.GetComponent NullReferenceException: Object> reference not set to an instance of an> object> GameScripts.BalloonBalance.GhostBuddy.FixedUpdate> () ( but couldn't figure out why because I have instatitated everything properly.

Viewing all articles
Browse latest Browse all 2891

Trending Articles



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