think im getting my wires crossed when storing and destroying objects.
get this error:
MissingReferenceException: The object
of type ‘GameObject’ has been
destroyed but you are still trying to
access it. Your script should either
check if it is null or you should not
destroy the object. grid.objGridSize
() (at Assets/scripts/grid.cs:119)
grid.hit (System.String hitObjString)
(at Assets/scripts/grid.cs:109)
grid.Update () (at
Assets/scripts/grid.cs:80)
from this:
// Something has been hit
public void hit(String hitObjString){
GameObject hitTile = GameObject.Find(hitObjString);
storePosition hitPos = hitTile.GetComponent<storePosition>();
if( hitTile.tag == "tile"){
objGrid[hitPos.x,hitPos.y] = nullTile;
Destroy(hitTile);
}
}
Destroy(hitTile.gameObject);
you are looking for this?
bbyford
3
yep, it started working changing my raycasthit out hitObj to hitObj.transfrom.gameObject instead of simply hitObj