Quantcast
Viewing all articles
Browse latest Browse all 2891

NullReferenceException.... When there shouldn't be one, what to do?

Hello, I'm getting the error "NullReferenceException: Object reference not set to an instance of an object" for the following code: ---------- Script CharBattleMove.cs is attached to an OverworldCharacter object in the scene and contains the following: private void Start() { transform.position = BattleManager.instance.nextHeroPosition; } private void FixedUpdate() { curPos = transform.position; if(curPos == lastPos) { BattleManager.instance.isWalking = false; } else { BattleManager.instance.isWalking = true; } lastPos = curPos; } Script BattleManager.cs is attached to a BattleManager object in the scene and contains the following code: public static BattleManager instance; public Vector3 nextHeroPosition; public bool isWalking = false; ---------- I've exhausted what I know how to do... can someone out there point me in the right direction on how to fix this? Thanks in advance

Viewing all articles
Browse latest Browse all 2891

Trending Articles