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 std::string type) |
|
void |
drawGizmos () |
void |
|
Actor * |
instantiate (Prefab * prefab, Vector3 position, Quaternion rotation) |
bool |
isEnabled () const |
Scene * |
scene () const |
void |
setEnabled (bool enabled) |
std::string |
tr (const std::string source) |
transform () const |
Static Methods
None
Methods Description
Actor * Component::actor () const
Returns an Actor which the Component is attached to.
Component * Component::component (std::string type)
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.
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().
std::string Component::tr (std::string source)
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.