Quantcast
Channel: Answers for "Missing GameObject and Null do not test the same, but how do I test for missing?"
Viewing all articles
Browse latest Browse all 12

Answer by Noztradamuz

$
0
0
Ok, maybe some code will help us, to help you, as far as i get with this i think the problem is that you're trying to acces a GameObject that's already been deleted (mean Null or Object reference not set to an instance of an object) if this is the case, you should put some checks like this OnCollisionEnter(Collision occupancyObject) { objInHere = occupancyObject.gameObject; } OnCollisionStay(Collision stayingObject) { if(objInHere!=null && stayingObject.gameObject == objInHere) { //Do whatever you need to } else { objInHere = null; } } Maybe this should help.

Viewing all articles
Browse latest Browse all 12

Trending Articles



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