GameObject Root { get; set; }

robot_2Generated
code_blocksInput

Description

Return the root GameObject. The root is the object that is parented to the scene - which could very much be this object.

Usage

Use the Root property to access the root GameObject of the current object. This is useful when you need to determine the top-level object in the hierarchy to which the current GameObject belongs.

Example

// Example of accessing the Root property
GameObject myObject = new GameObject();
GameObject rootObject = myObject.Root;

if (rootObject == myObject)
{
    // This object is the root
    // Perform operations specific to root objects
}
else
{
    // This object is not the root
    // Perform operations specific to non-root objects
}