GameObject Root { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

Returns the root GameObject. The root is the object that is parented to the scene, which could very well be this object itself.

Usage

Use the Root property to access the top-level GameObject in the hierarchy. This is useful when you need to perform operations or checks on the root object of a scene or a hierarchy of objects.

Example

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

if (rootObject != null)
{
    // Perform operations on the root object
    rootObject.Name = "RootObject";
}