Preparing search index...

    Class SceneObject

    // 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);
    }

    Hierarchy (View Summary)

    Index

    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.

    isEnabledInHiearchy: boolean

    Check if a SceneObject is enabled in the hiearchy. It is enabled if both its own enabled property is true, and that of all of its parents to the root of the scene.

    Use SceneObject.isEnabledInHierarchy instead (note the corrected spelling).

    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 Camera 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 a list of all components attached to the SceneObject.

      Returns Component[]

    • 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 attached component of type componentType at index index. If componentType is an empty string, all component types are considered.

      Type Parameters

      Parameters

      • componentType: K
      • index: number

      Returns ComponentNameMap[K]

    • Returns the number of components of type componentType attached to the SceneObject. If componentType is an empty string, the total number of components attached is returned.

      Type Parameters

      Parameters

      • componentType: K

      Returns number

    • Returns the first Component with type matching or deriving from componentType found in the ancestors of this object. The search stops immediately upon finding a match.

      Arguments:

      • componentType: If an empty string, all Component types are considered.
      • onlyEnabled: If true, the search only returns Components where isEnabledInHierarchy is true. This means the Component itself must be enabled, and its SceneObject must be enabled in the hierarchy. Defaults to false.
      • includeSelf: If true, the search will include the SceneObject this is called on. Defaults to false.
      • maxDepth: Limits how many levels up to search. Use Infinity for an unlimited search depth. Defaults to Infinity.

      The search begins at the immediate parent, or at self if includeSelf is true. Returns null if no matching Component is found.

      Note: Hierarchy searches can be very expensive. Be mindful of what, and how often you're searching.

      Type Parameters

      Parameters

      • componentType: K
      • OptionalonlyEnabled: boolean
      • OptionalincludeSelf: boolean
      • OptionalmaxDepth: number

      Returns ComponentNameMap[K]

      // Find the first Camera in the ancestor hierarchy.
      var camera = sceneObject.getComponentInAncestors("Component.Camera");

      // Search this SceneObject and its ancestors for an enabled RenderMeshVisual.
      var visual = sceneObject.getComponentInAncestors("Component.RenderMeshVisual", true, true);

      // Search only the direct parent, including disabled components, excluding this SceneObject.
      var camera = sceneObject.getComponentInAncestors("Component.Camera", false, false, 1);
    • Type Parameters

      Parameters

      Returns Result

    • Returns the first Component with type matching or deriving from componentType found in the descendants of this object. The search stops immediately upon finding a match.

      Arguments:

      • componentType: If an empty string, all Component types are considered.
      • onlyEnabled: If true, the search only returns Components where isEnabledInHierarchy is true. This means disabled SceneObjects are skipped during traversal, and both the Component and its SceneObject must be enabled in the hierarchy. Defaults to false.
      • includeSelf: If true, the search will include the SceneObject this is called on. Defaults to false.
      • maxDepth: Limits how many levels down to search. Use Infinity for an unlimited search depth. Defaults to Infinity.

      The search begins at the immediate children, or at self if includeSelf is true, and uses Breadth-First Search to find the nearest match. Returns null if no matching Component is found.

      Note: Hierarchy searches can be very expensive. Be mindful of what, and how often you're searching.

      Type Parameters

      Parameters

      • componentType: K
      • OptionalonlyEnabled: boolean
      • OptionalincludeSelf: boolean
      • OptionalmaxDepth: number

      Returns ComponentNameMap[K]

      // Find the first RenderMeshVisual in the descendant hierarchy.
      var visual = sceneObject.getComponentInDescendants("Component.RenderMeshVisual");

      // Search this SceneObject and its descendants for an enabled Camera.
      var camera = sceneObject.getComponentInDescendants("Component.Camera", true, true);

      // Search only immediate children, including disabled components, excluding this SceneObject.
      var visual = sceneObject.getComponentInDescendants("Component.RenderMeshVisual", false, false, 1);
    • Type Parameters

      Parameters

      Returns Result

    • Returns an array of all Components with type matching or deriving from componentType found in the ancestors of this object. This search does not stop at the first match.

      Arguments:

      • componentType: If an empty string, all Component types are considered.
      • onlyEnabled: If true, the search only returns Components where isEnabledInHierarchy is true. This means the Component itself must be enabled, and its SceneObject must be enabled in the hierarchy. Defaults to false.
      • includeSelf: If true, the search will include the SceneObject this is called on. Defaults to false.
      • maxDepth: Limits how many levels up to search. Use Infinity for an unlimited search depth. Defaults to Infinity.

      The search begins at the immediate parent, or at self if includeSelf is true. Returns an empty array if no matching Components are found.

      Note: Hierarchy searches can be very expensive. Be mindful of what, and how often you're searching.

      Type Parameters

      Parameters

      • componentType: K
      • OptionalonlyEnabled: boolean
      • OptionalincludeSelf: boolean
      • OptionalmaxDepth: number

      Returns ComponentNameMap[K][]

      // Collect all Cameras from ancestor hierarchy.
      var cameras = sceneObject.getComponentsInAncestors("Component.Camera");

      // Search this SceneObject and its ancestors for all enabled RenderMeshVisuals.
      var visuals = sceneObject.getComponentsInAncestors("Component.RenderMeshVisual", true, true);

      // Search only the direct parent, including disabled, excluding this SceneObject.
      var cameras = sceneObject.getComponentsInAncestors("Component.Camera", false, false, 1);
    • Type Parameters

      Parameters

      Returns Result[]

    • Returns an array of all Components with type matching or deriving from componentType found in the descendants of this object. This search does not stop at the first match. Restrict maxDepth to minimize performance cost.

      Arguments:

      • componentType: If an empty string, all Component types are considered.
      • onlyEnabled: If true, the search only returns Components where isEnabledInHierarchy is true. This means disabled SceneObjects are skipped during traversal, and both the Component and its SceneObject must be enabled in the hierarchy. Defaults to false.
      • includeSelf: If true, the search will include the SceneObject this is called on. Defaults to false.
      • maxDepth: Limits how many levels down to search. Use Infinity for an unlimited search depth. Defaults to Infinity.

      The search begins at the immediate children, or at self if includeSelf is true, and uses Breadth-First Search. Returns an empty array if no matching Components are found.

      Note: Hierarchy searches can be very expensive. Be mindful of what, and how often you're searching.

      Type Parameters

      Parameters

      • componentType: K
      • OptionalonlyEnabled: boolean
      • OptionalincludeSelf: boolean
      • OptionalmaxDepth: number

      Returns ComponentNameMap[K][]

      // Collect all RenderMeshVisuals in the descendant hierarchy.
      var visuals = sceneObject.getComponentsInDescendants("Component.RenderMeshVisual");

      // Search this SceneObject and its descendants for all enabled Cameras.
      var cameras = sceneObject.getComponentsInDescendants("Component.Camera", true, true);

      // Search only immediate children, including disabled components, excluding this SceneObject.
      var visuals = sceneObject.getComponentsInDescendants("Component.RenderMeshVisual", false, false, 1);
    • Type Parameters

      Parameters

      Returns Result[]

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

      Returns SceneObject

    • Returns the current render layer of the SceneObject.

      Returns number

      Use SceneObject#layer instead

    • 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 this SceneObject is a descendant (child, grandchild, etc.) of potentialAncestor. Returns false otherwise.

      Note: Hierarchy searches can be very expensive. Be mindful of what, and how often you're searching.

      Parameters

      Returns boolean

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

      Parameters

      • type: string

      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

      // 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);
      }
    • Sets the render layer of the SceneObject to id.

      Parameters

      • id: number

      Returns void

      Use SceneObject#layer instead