GameObject Class |
Namespace: GeonBit.ECS
public class GameObject
The GameObject type exposes the following members.
Name | Description | |
---|---|---|
GameObject |
Create the game object.
|
Name | Description | |
---|---|---|
ActiveScene |
Get the currently active scene instance.
| |
Count |
Count how many GameObject instances currently exist.
Note: 'Destroy' doesn't decrease the counter, only when the real class destrcutor is called (eg object is cleared from memory) counter is decreased.
| |
Enabled |
Enable / disable this object.
Disabled objects will not update any components and will not render.
| |
IsActuallyEnabled |
Return true only if this GameObject and all his parents are enabled.
| |
IsActuallyVisible |
Return true only if this GameObject and all his parents are visible.
| |
IsInActiveScene |
Return if this object is inside the currently active scene.
| |
IsInScene |
Get if this Game Object currently belong to any scene.
| |
IsRoot |
Get if this game object is the root of the currently loaded scene.
| |
Name |
Object name (don't have to be unique).
| |
Parent |
Get / Set the parent of this GameObject.
| |
ParentScene |
Get the parent scene of this game object.
| |
PhysicalBody |
An alias to get the first physical body added to this GameObject.
This is useful for performance and ease of access, since Physical Body is something that you often need to access.
| |
SceneNode |
Get the scene node of this Game Object.
| |
Visible |
Get / set object visibility.
Invisible objects won't render, but will still update components.
| |
WasDestroyed |
Get if this object was destroyed and should not be used anymore.
|
Name | Description | |
---|---|---|
AddComponent |
Add a component to this GameObject instance.
| |
AddComponentDebug |
Add a component to this GameObject instance, but only if in debug mode.
If not in debug mode, will do nothing.
| |
BeforeDraw |
Called every frame to do updates right before drawing scene.
| |
CallCollisionEnd |
Called when the Game Object stop colliding with another object.
| |
CallCollisionProcess |
Called every frame while the Game Object is colliding with another object.
| |
CallCollisionStart |
Called when the Game Object start colliding with another object.
| |
CallSpawnEvent |
Spawn event is something that should be called once after the game object is ready with all components.
| |
Clone |
Clone this game object.
| |
CreateOctree |
Create an octree object with params.
| |
Destroy |
Destroy this Game Object.
| |
DoOnUpdate |
Register a function to call on every update loop.
This is a quick method to add per-object functionality without defining a component type.
| |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
Find |
Find a child GameObject.
| |
FixedUpdate |
Triggers a Fixed Update event (update that happens every const amount of seconds).
| |
GetComponentCompType |
Get component by type / name.
| |
GetComponentsCompType |
Get all components by type / name.
| |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
Heartbeat |
Trigger a heartbeat event.
| |
RemoveComponent |
Remove a component from this GameObject instance.
| |
SendMessage |
Invoke the 'OnReceiveMessage' callback of all the components of this entity.
Note: this is used mostly for communication between user scripts.
| |
ToString | Returns a string that represents the current object. (Inherited from Object.) | |
Trigger |
Iterate over all the components and call 'methodName()', if such method exists.
| |
Update |
Called every frame to do GameObject events.
|
Name | Description | |
---|---|---|
DefaultSceneNodeType |
Default scene node to use when no node type is provided in GameObject constructor.
| |
DisableUpdateEvents |
If true, will disable update events (Update and FixedUpdate) for this game object and all its children and components.
This optimization is useful for containers that hold a lot of graphic entities, but don't have any updating logic.
| |
HeartbeatInterval |
How often, in seconds, to trigger "heartbeat" event.
For example, 0.1f means heartbeat every 100 ms.
| |
OctreeMaxDivisions |
How many times we can divide octree nodes, until reaching the minimum bounding box size.
| |
OctreeSceneBoundaries |
Bounding box to use for octree culling.
If you use octree culling scene node, objects that exceed this bounding box won't be culled properly.
| |
UpdateWhenNotVisible |
If true, will call this GameObject Update() and FixedUpdate() even when not visible (outside camera / culled).
If false, will not call Update() and FixedUpdate() when outside camera boundaries.
| |
UserData |
Optional data you can attach to this game object.
Note: this data will not be serialized / deserialized.
|