Inheritence

Component
AmbientLight
AudioListener
BaseSoundComponent
BeamEffect
CameraComponent
CharacterController
CitizenAnimationHelper
Collider
CubemapFog
Decal
Dresser
EnvmapProbe
FireDamage
GradientFog
HammerMesh
HighlightOutline
Joint
LegacyParticleSystem
Light
LipSync
ManualHitbox
MapInstance
MapObjectComponent
MapSkybox3D
MissingComponent
ModelHitboxes
ModelPhysics
MoveMode
MoviePlayer
NavMeshAgent
NavMeshArea
NavMeshLink
NetworkHelper
PanelComponent
ParticleController
ParticleEffect
ParticleEmitter
PlayerController
PostProcess
Prop
RadiusDamage
Renderer
Rigidbody
SceneInformation
ScreenPanel
SkyBox2D
SoundscapeTrigger
SpawnPoint
TemporaryEffect
TransformProxyComponent
TriggerHurt
Voice
VolumeComponent
VolumetricFogController
VolumetricFogVolume
VRAnchor
VRHand
VRModelRenderer
VRTrackedObject
WorldInput

Summary

A GameObject can have many components, which are the building blocks of the game.

Constructors

Component

Properties

Active True if this Component is enabled, and all of its ancestor GameObjects are enabled
Components Access components on this component's GameObject
ComponentVersion The version of the component. Used by Sandbox.JsonUpgrader.
DebugOverlay Allows drawing of temporary debug shapes and text in the scene
Enabled <para> The enable state of this Sandbox.Component. </para><para> This doesn't tell you whether the component is actually active because its parent Sandbox.GameObject might be disabled. This merely tells you what the component wants to be. You should use Sandbox.Component.Active to determine whether the object is truly active in the scene. </para>
Flags
GameObject The GameObject this component belongs to.
Id
IsProxy True if this is a networked object and is owned by another client. This means that we're not controlling this object, so shouldn't try to move it or anything.
IsValid
LocalPosition The local position of the game object.
LocalRotation The local rotation of the game object.
LocalScale The local scale of the game object.
LocalTransform The local transform of the game object.
Network
OnComponentDestroy
OnComponentDisabled
OnComponentEnabled
OnComponentFixedUpdate
OnComponentStart
OnComponentUpdate
Scene The scene this Component is in. This is a shortcut for `GameObject.Scene`.
Tags
Task Allow creating tasks that are automatically cancelled when the GameObject is destroyed.
Transform The transform of the GameObject this component belongs to. Components don't have their own transforms but they can access the transform of the GameObject they belong to. This is a shortcut for `GameObject.Transform`.
WorldPosition The world position of the game object.
WorldRotation The world rotation of the game object.
WorldScale The world scale of the game object.
WorldTransform The world transform of the game object.

Methods

__rpc_Wrapper
__sync_GetValue
__sync_SetValue
AddComponent Add a component to this GameObject
Deserialize
DeserializeImmediately Deserialize this component as per Sandbox.Component.Deserialize(System.Text.Json.Nodes.JsonObject) but update Sandbox.Component.GameObject and Sandbox.Component property references immediately instead of having them deferred.
Destroy Destroy this component, if it isn't already destroyed. The component will be removed from its GameObject and will stop existing. You should avoid interating with the component after calling this.
DestroyGameObject Destroy the parent GameObject. This really only exists so when you're typing Destroy you realise that calling Destroy only destroys the Component - not the whole GameObject.
DrawGizmos Called in the editor to draw things like bounding boxes etc
EditLogobsolete Called when something on the component has been edited
GetComponent Get a component on this GameObject
GetComponentInChildren Get component on this GameObject or on descendant GameObjects
GetComponentInParent Get component on this GameObject and on ancestor GameObjects
GetComponents Get components on this GameObject
GetComponentsInChildren Get components on this GameObject and on descendant GameObjects
GetComponentsInParent Get components on this GameObject and on ancestor GameObjects
GetOrAddComponent Add a component to this GameObject
Invoke Invoke a method in x seconds. Won't be invoked if the component is no longer active.
OnAwake Called once per component
OnDestroy Called once, when the component or gameobject is destroyed
OnDirty Called when the component has become dirty
OnDisabled
OnEnabled Called after Awake or whenever the component switches to being enabled (because a gameobject heirachy active change, or the component changed)
OnFixedUpdate When enabled, called on a fixed interval that is determined by the Scene. This is also the fixed interval in which the physics are ticked. Time.Delta is that fixed interval.
OnLoad
OnParentChanged The parent has changed from one parent to another
OnParentDestroy The parent object is being destroyed. This is a nice place to switch to a healthier parent.
OnPreRender When enabled, called every frame, does not get called on a dedicated server
OnPropertyDirty
OnRefresh Called immediately after being refreshed from a network snapshot.
OnStart Called once before the first Update - when enabled.
OnTagsChanged When tags have been updated
OnUpdate When enabled, called every frame
OnValidate Called immediately after deserializing, and when a property is changed in the editor.
Reset
Serialize

Static Methods

CopyToClipboard Copy the target Sandbox.Component to the clipboard.
DispatchEdited Run the Editor.EditorEvent.ISceneEdited.ComponentEdited(Sandbox.Component,System.String) event for the given property.
DispatchPreEdited Run the Editor.EditorEvent.ISceneEdited.ComponentPreEdited(Sandbox.Component,System.String) event for the given property.
JsonRead
JsonWrite
PasteValues Paste component values from clipboard to the target Sandbox.Component.
people
Log in to reply
You can't reply if you're not logged in. That would be crazy.