unity how to detect if gameobject has parent code example Example: check if object has parent unity if(transform.parent != null) { }