Class Component
Game element that can be added to GameObjects to provide local behavior or data. Components can be added, moved, and removed at runtime.
public abstract class Component : GameElement
- Inheritance
-
Component
- Derived
- Inherited Members
Properties
GameObject
Gets or sets the game object that this component is part of.
public GameObject GameObject { get; set; }
Property Value
Methods
Destroy()
Removes this component from its GameObject .
public void Destroy()
GetRequiredComponent<TComponent>()
Tries to get a component of type TComponent from the containing
game object, throwing if it cannot be found.
protected TComponent GetRequiredComponent<TComponent>()
Returns
- TComponent
The game object's instance of
TComponent.
Type Parameters
TComponentThe type of component to look for.
Exceptions
- MissingComponentException<TMissing>
Thrown if no matching component is found.
Tick()
Called once per tick.
protected virtual void Tick()