unity check if object is root object code example Example: check if object has parent unity if(transform.parent != null) { }