bool IsRoot { get; set; }

robot_2Generated
code_blocksInput

Description

Returns true if this is a root object. Root objects are parented directly to the scene.

Usage

Use the IsRoot property to determine if a GameObject is a root object in the scene hierarchy. This can be useful for operations that need to be performed only on root objects, such as scene-wide transformations or initializations.

Example

// Example of checking if a GameObject is a root object
GameObject myObject = new GameObject();

if (myObject.IsRoot)
{
    // Perform operations specific to root objects
    // For example, logging or applying scene-wide settings
    Debug.Log("This object is a root object.");
}
else
{
    Debug.Log("This object is not a root object.");
}