public void setVel(int x, int y) { if(_canMove) { _vel.x=x; _vel.y=y; if(!(x==0 &&y==0)){ //TODO: //because of how untiy instantiated prefabs, sometimes the GridCOntroller is not available when this object instantiates. This fetches it whenver it is needed. //Im assuming this in not very efficient. grid=(GridController)GameObject.FindObjectOfType(typeof(GridController)); grid.resolveMovement(this); } } }