bool IsRoot { get; set; }

robot_2Generated
code_blocksInput

Description

The IsRoot property of a GameObject indicates whether the object is a root object within the scene. A root object is one that is directly parented to the scene, meaning it does not have any parent GameObject and is at the top level of the scene hierarchy.

Usage

Use the IsRoot property to determine if a GameObject is a root object. This can be useful when you need to perform operations that are specific to root objects, such as managing scene-level transformations or organizing objects within the scene.

Example

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

if (myObject.IsRoot)
{
    // Perform operations specific to root objects
    Console.WriteLine("This object is a root object.");
}
else
{
    // Handle non-root objects
    Console.WriteLine("This object is not a root object.");
}