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.
↧