Hey guys, right now, I can’t seem to get my cloned object’s parent’s name.
After instantiating my object, it became a child of another object.
So, this code
if (transform.parent.name == "DropZone1")
pos = new Vector3(-0.475f, 0,0);
returns a NullReference. I’m guessing it’s trying to reference its prefab, which doesn’t have a parent. But it’s already in the game, so it should be trying to reference it’s current parent instead.
print (transform.parent.name);
Debug.Log (transform.parent.name);
both also returns a NullReference.
Anyone knows a solution to this?
Thanks!