ReadonlychildrenGet an array of the scene object's children.
Whether the SceneObject, including its components and children, is enabled or disabled.
ReadonlyisCheck 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).
ReadonlyisReturns true if this SceneObject and all of its parents are enabled.
Gets or sets the LayerSet of layers this SceneObject belongs to. This is used to determine which Camera will render the SceneObject.
The name of the SceneObject.
ReadonlyonAn event that will trigger when a SceneObject goes from enabled in the hiearchy to disabled in the hiearchy.
ReadonlyonAn event that will trigger when a SceneObject goes from disabled in the hiearchy to enabled in the hiearchy.
ReadonlyuniqueCreates a shallow copy of the passed in sceneObject (not including its hierarchy), and parents it to this SceneObject.
Creates a deep copy of the passed in sceneObject (including its hierarchy), and parents it to this SceneObject.
Adds a new component of type typeName to the SceneObject.
Destroys the SceneObject.
Returns the number of children the SceneObject has.
Returns the first attached Component with type matching or deriving from componentType.
Returns the attached component of type componentType at index index. If componentType is an empty string, all component types are considered.
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.
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.
OptionalonlyEnabled: booleanOptionalincludeSelf: booleanOptionalmaxDepth: number// 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);
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.
OptionalonlyEnabled: booleanOptionalincludeSelf: booleanOptionalmaxDepth: number// 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);
Returns a list of attached components with types matching or deriving from componentType.
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.
OptionalonlyEnabled: booleanOptionalincludeSelf: booleanOptionalmaxDepth: number// 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);
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.
OptionalonlyEnabled: booleanOptionalincludeSelf: booleanOptionalmaxDepth: number// 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);
Returns the first attached component of type componentType. If componentType is an empty string, the first component of any type is returned.
Returns the SceneObject's parent in the hierarchy, or null if there isn't one.
Returns the current render layer of the SceneObject.
Use SceneObject#layer instead
Returns the Transform attached to the SceneObject.
Returns the name of this object's type.
Returns whether the SceneObject has a parent in the scene hierarchy.
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.
Returns true if the object matches or derives from the passed in type.
Returns true if this object is the same as other. Useful for checking if two references point to the same thing.
Unparents the SceneObject in the hierarchy, making it an orphan.
Sets the SceneObject's parent to newParent in the scene hierarchy.
Changes the parent of the SceneObject without altering its world position, rotation, or scale.
// 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.
Use SceneObject#layer instead
An object in the scene hierarchy, containing a Transform and possibly Component. A script can access the SceneObject holding it through the method
script.getSceneObject().Used By
Returned By
Example