Component¶
Inherited: None
Description¶
The Component class is a base class for each aspect of the actor, and how it interacts with the world.
Note: This class must be a superclass only and shouldn’t be created manually.
Public Methods¶
Actor * |
actor () const |
component (const TString & type) |
|
void |
drawGizmos () |
void |
|
Actor * |
instantiate (Prefab * prefab, Vector3 position, Quaternion rotation) |
bool |
isEnabled () const |
bool |
isEnabledInHierarchy () const |
Scene * |
scene () const |
void |
setEnabled (bool enabled) |
tr (const TString & source) |
|
transform () const |
|
World * |
world () const |
Static Methods¶
None
Methods Description¶
Actor * Component::actor () const
Returns an Actor which the Component is attached to.
Returns a component with type attached to the same Actor. If no such component with this type returns nullptr.
void Component::drawGizmos ()
Implement drawGizmos if you want to draw gizmos that are always drawn.
void Component::drawGizmosSelected ()
Implement drawGizmosSelected to draw a gizmo if the object is selected.
Actor * Component::instantiate (Prefab * prefab, Vector3 position, Quaternion rotation)
Clones the actor represented by prefab asset. This Actor will be a sibling of caller Actor and has local position and rotation.
bool Component::isEnabled () const
Returns true if the component is enabled; otherwise returns false.
bool Component::isEnabledInHierarchy () const
Returns false in case of one of Actors in top hierarchy or this component was disabled; otherwise returns true.
Scene * Component::scene () const
Returns a Scene which the Component is attached to.
void Component::setEnabled (bool enabled)
Sets current state of component to enabled or disabled.
Note: The disabled component will be created but not affect the Actor. For example, MeshRender component will not draw a mesh.
See also isEnabled().
Returns a translated version of source text; otherwise returns source text if no appropriate translated std::string is available.
Transform * Component::transform () const
Returns a transform attached to this Actor.
World * Component::world () const
Returns a World which the Component is attached to.