An object in the scene hierarchy, containing a Transform and possibly Components. A script can access the SceneObject holding it through the method script.getSceneObject().

// Look for a MaterialMeshVisual on this SceneObject
var sceneObj = script.getSceneObject();
var meshVisual = sceneObj.getComponent("Component.MaterialMeshVisual");
if(meshVisual)
{
// ...
}
// Rename each child SceneObject
var sceneObj = script.getSceneObject();
for(var i=0; i<sceneObj.getChildrenCount(); i++)
{
var child = sceneObj.getChild(i);
var newName = i + "_" + child.name;
child.name = newName;
print(child.name);
}
interface SceneObject {
    children: SceneObject[];
    enabled: boolean;
    isEnabledInHierarchy: boolean;
    layer: LayerSet;
    name: string;
    onDisabled: event0<void>;
    onEnabled: event0<void>;
    uniqueIdentifier: string;
    copyComponent<K>(component: K): K;
    copySceneObject(sceneObject: SceneObject): SceneObject;
    copyWholeHierarchy(sceneObject: SceneObject): SceneObject;
    createComponent<K>(typeName: K): ComponentNameMap[K];
    createComponent<Result>(componentType: Result extends BaseScriptComponent
        ? TypeName<Result<Result>>
        : never): Result;
    destroy(): void;
    getChild(index: number): SceneObject;
    getChildrenCount(): number;
    getComponent<K>(componentType: K): ComponentNameMap[K];
    getComponent<Result>(componentType: Result extends BaseScriptComponent
        ? TypeName<Result<Result>>
        : never): Result;
    getComponents<K>(componentType: K): ComponentNameMap[K][];
    getComponents<Result>(componentType: Result extends BaseScriptComponent
        ? TypeName<Result<Result>>
        : never): Result[];
    getParent(): SceneObject;
    getTransform(): Transform;
    getTypeName(): string;
    hasParent(): boolean;
    isOfType(type: string): boolean;
    isSame(other: ScriptObject): boolean;
    removeParent(): void;
    setParent(newParent: SceneObject): void;
    setParentPreserveWorldTransform(newParent: SceneObject): void;
}

Hierarchy (view full)

Properties

children: SceneObject[]

Get an array of the scene object's children.

enabled: boolean

Whether the SceneObject, including its components and children, is enabled or disabled.

isEnabledInHierarchy: boolean

Returns true if this SceneObject and all of its parents are enabled.

layer: LayerSet

Gets or sets the LayerSet of layers this SceneObject belongs to. This is used to determine which Cameras will render the SceneObject.

name: string

The name of the SceneObject.

onDisabled: event0<void>

An event that will trigger when a SceneObject goes from enabled in the hiearchy to disabled in the hiearchy.

onEnabled: event0<void>

An event that will trigger when a SceneObject goes from disabled in the hiearchy to enabled in the hiearchy.

uniqueIdentifier: string

Methods

  • Copies component and adds it to the SceneObject, then returns it.

    Type Parameters

    Parameters

    • component: K

    Returns K

  • Creates a shallow copy of the passed in sceneObject (not including its hierarchy), and parents it to this SceneObject.

    Parameters

    Returns SceneObject

  • Creates a deep copy of the passed in sceneObject (including its hierarchy), and parents it to this SceneObject.

    Parameters

    Returns SceneObject

  • Destroys the SceneObject.

    Returns void

  • Returns this SceneObject's child at index index.

    Parameters

    • index: number

    Returns SceneObject

  • Returns the number of children the SceneObject has.

    Returns number

  • Returns the SceneObject's parent in the hierarchy, or null if there isn't one.

    Returns SceneObject

  • Returns the Transform attached to the SceneObject.

    Returns Transform

  • Returns whether the SceneObject has a parent in the scene hierarchy.

    Returns boolean

  • Returns true if the object matches or derives from the passed in type.

    Parameters

    • type: string

    Returns boolean

  • Returns true if this object is the same as other. Useful for checking if two references point to the same thing.

    Parameters

    Returns boolean

  • Unparents the SceneObject in the hierarchy, making it an orphan.

    Returns void

  • Sets the SceneObject's parent to newParent in the scene hierarchy.

    Parameters

    Returns void

  • Changes the parent of the SceneObject without altering its world position, rotation, or scale.

    Parameters

    Returns void