Protected
constructorReadonly
childrenGet an array of the scene object's children.
Whether the SceneObject, including its components and children, is enabled or disabled.
Readonly
isCheck 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.
Readonly
isReturns 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.
Readonly
onAn event that will trigger when a SceneObject goes from enabled in the hiearchy to disabled in the hiearchy.
Readonly
onAn event that will trigger when a SceneObject goes from disabled in the hiearchy to enabled in the hiearchy.
Readonly
uniqueCreates 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 a list of attached components with types matching or deriving from componentType
.
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 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 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.
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()
.Example