class Component

book_4_sparkGenerated
code_blocksInput

Description

The Component class in the Sandbox namespace is a fundamental building block for GameObjects. It allows for the addition of various functionalities to GameObjects, enabling complex behaviors and interactions within a scene. Components are versatile and can be used to manage game logic, handle user input, and more.

Members

Instance Members

Member NameSummary
DestroyDestroy this component, if it isn't already destroyed. The component will be removed from its GameObject and will stop existing. You should avoid interacting with the component after calling this.
DestroyGameObjectDestroy the parent GameObject. This method helps clarify that calling Destroy only affects the Component, not the entire GameObject.
ResetResets the component to its default state.
EditLogCalled when something on the component has been edited. (Obsolete: Use Scene.Editor.UndoScope or Scene.Editor.AddUndo instead.)
InvokeInvoke a method in x seconds. Won't be invoked if the component is no longer active.
AddComponentAdd a component to this GameObject.
GetOrAddComponentAdd a component to this GameObject if it doesn't already exist.
GetComponentGet a component on this GameObject.
GetComponentsGet components on this GameObject.
GetComponentsInChildrenGet components on this GameObject and on descendant GameObjects.
GetComponentInChildrenGet component on this GameObject or on descendant GameObjects.
GetComponentsInParentGet components on this GameObject and on ancestor GameObjects.
GetComponentInParentGet component on this GameObject and on ancestor GameObjects.
SerializeSerialize this component to a JSON node.
DeserializeDeserialize this component from a JSON node.
DeserializeImmediatelyDeserialize this component immediately, updating GameObject and property references.
JsonReadRead JSON data into this component.
JsonWriteWrite this component's data to JSON.
SceneThe scene this Component is in. This is a shortcut for `GameObject.Scene`.
TransformThe transform of the GameObject this component belongs to. This is a shortcut for `GameObject.Transform`.
GameObjectThe GameObject this component belongs to.
ComponentsAccess components on this component's GameObject.
EnabledThe enable state of this Component. This doesn't tell you whether the component is actually active because its parent GameObject might be disabled.
ActiveTrue if this Component is enabled, and all of its ancestor GameObjects are enabled.
IsValidIndicates whether the component is valid.
OnComponentEnabledAction triggered when the component is enabled.
OnComponentStartAction triggered when the component starts.
OnComponentUpdateAction triggered when the component updates.
OnComponentFixedUpdateAction triggered during the component's fixed update.
OnComponentDisabledAction triggered when the component is disabled.
OnComponentDestroyAction triggered when the component is destroyed.
TagsTags associated with this component.
DebugOverlayAllows drawing of temporary debug shapes and text in the scene.
FlagsFlags associated with this component.
IdThe unique identifier for this component.
LocalTransformThe local transform of the game object.
LocalPositionThe local position of the game object.
LocalRotationThe local rotation of the game object.
LocalScaleThe local scale of the game object.
NetworkNetwork accessor for this component.
IsProxyTrue if this is a networked object and is owned by another client.
ComponentVersionThe version of the component. Used by JsonUpgrader.
WorldTransformThe world transform of the game object.
WorldPositionThe world position of the game object.
WorldRotationThe world rotation of the game object.
WorldScaleThe world scale of the game object.