Class Entity
- Namespace
- AO
- Assembly
- CoreAssembly.dll
Entities are the base object we work with. They can have components attached to them and can be parented to other entities.
public class Entity
- Inheritance
-
Entity
- Inherited Members
- Extension Methods
Fields
MarkedForDestroy
Is the entity itself destroyed.
public bool MarkedForDestroy
Field Value
Properties
Children
All children directly under this entity
public Entity.ChildEnumerator Children { get; }
Property Value
Id
The unique generational ID of this entity.
public ulong Id { get; }
Property Value
IdGeneration
The generation part of the entity ID.
public int IdGeneration { get; }
Property Value
IdIndex
The index part of the entity ID.
public int IdIndex { get; }
Property Value
LocalEnabled
Is the entity itself enabled.
public bool LocalEnabled { get; set; }
Property Value
LocalPosition
The local position of the entity.
public Vector2 LocalPosition { get; set; }
Property Value
LocalRotation
The local rotation of the entity in degrees.
public float LocalRotation { get; set; }
Property Value
LocalRotationTurns
The world rotation of the entity in turns
public float LocalRotationTurns { get; set; }
Property Value
LocalScale
The local scale of the entity.
public Vector2 LocalScale { get; set; }
Property Value
LocalScaleX
Utility to grab the entity's local X scale
public float LocalScaleX { get; set; }
Property Value
LocalScaleY
Utility to grab the entity's lcoal Y scale
public float LocalScaleY { get; set; }
Property Value
LocalX
Utility to get/set the entity's local X position
public float LocalX { get; set; }
Property Value
LocalY
Utility to get/set the entity's local Y position
public float LocalY { get; set; }
Property Value
Name
Entity name
public string Name { get; set; }
Property Value
NetSyncDataFrameNumber
public uint NetSyncDataFrameNumber { get; }
Property Value
NetSyncFlags
public Entity.NetSyncOptions NetSyncFlags { get; set; }
Property Value
NetSyncReceiveFrameNumber
public uint NetSyncReceiveFrameNumber { get; }
Property Value
NetworkId
The unique network id of the entity. Can be used to describe entities across the network
public ulong NetworkId { get; }
Property Value
Parent
Gets the parent of the entity. Null if this entity is at root level in the scene.
public Entity Parent { get; }
Property Value
Position
The world position of the entity. Takes into account all the parent enties transform matrix.
public Vector2 Position { get; set; }
Property Value
Rotation
The world rotaiton of the entity in degrees. Takes into account all the parent enties transform matrix.
public float Rotation { get; set; }
Property Value
RotationTurns
The world rotation of the entity in turns
public float RotationTurns { get; set; }
Property Value
Scale
The world scale of the entity. Takes into account all the parent enties transform matrix.
public Vector2 Scale { get; set; }
Property Value
ServerPosition
public Vector2 ServerPosition { get; }
Property Value
WorldEnabled
Is the entity and all its parents enabled.
public bool WorldEnabled { get; }
Property Value
X
Utility to get/set the entity's X position
public float X { get; set; }
Property Value
Y
Utility to get/set the entity's Y position
public float Y { get; set; }
Property Value
Methods
AddComponent(Type, Action<Component>)
public Component AddComponent(Type type, Action<Component> onBeforeAwake = null)
Parameters
Returns
AddComponent<T>(Action<T>)
Add a component of type T to this entity
public T AddComponent<T>(Action<T> onBeforeAwake = null) where T : Component
Parameters
onBeforeAwake
Action<T>
Returns
- T
Type Parameters
T
CalculateWorldMatrix()
The world matrix of the entity. Takes into account all the parent enties transform matrix.
public Matrix4 CalculateWorldMatrix()
Returns
Clone()
Clone this entity
public Entity Clone()
Returns
Create()
Create a new empty entity
public static extern Entity Create()
Returns
- Entity
The new entity
Destroy()
Mark this entity for destruction
public void Destroy()
FindByName(string)
Find an entity by its name
public static extern Entity FindByName(string name)
Parameters
name
string
Returns
- Entity
The entity matching the name
FindByNetworkId(ulong)
Find an entity by its network id
public static extern Entity FindByNetworkId(ulong network_id)
Parameters
network_id
ulong
Returns
- Entity
The entity matching the network id
FindComponentByNetworkId(ulong, ulong, out Entity, out Component)
Find an entity and component by its network id and component id
public static extern void FindComponentByNetworkId(ulong network_id, ulong component_id, out Entity e, out Component c)
Parameters
GetAllComponents(List<Component>)
Populate the given list with references to all components attached to this entity.
public void GetAllComponents(List<Component> outComponents)
Parameters
GetChildCount()
Gets how many children this entity has
public int GetChildCount()
Returns
GetComponentById(ulong)
Get the component with the given ID attached to this entity.
public Component GetComponentById(ulong componentId)
Parameters
componentId
ulong
Returns
GetComponent<T>(ulong)
Get the first component of type T attached to this entity
public T GetComponent<T>(ulong componentId = 0) where T : Component
Parameters
componentId
ulong
Returns
- T
Type Parameters
T
GetSceneHierarchyPath()
public string GetSceneHierarchyPath()
Returns
Instantiate(Prefab, Action<Entity>)
Instantiate a prefab into the scene
public static Entity Instantiate(Prefab prefab, Action<Entity> onBeforeAwake = null)
Parameters
Returns
RemoveComponent(Component)
Remove the specified component from this entity.
public void RemoveComponent(Component component)
Parameters
component
Component
RemoveComponent<T>()
Remove the first component found of type T from this entity.
public void RemoveComponent<T>() where T : Component
Type Parameters
T
SetParent(Entity, bool)
Set the parent of the entity.
public void SetParent(Entity newParent, bool keepWorldPosition)
Parameters
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
TryGetChildByIndex(int)
Gets a child of this entity by index. Returns null if index is negative or if index is greater than or equal to the number of children.
public Entity TryGetChildByIndex(int index)
Parameters
index
int
Returns
TryGetChildByName(string)
Gets a child of this entity with matching name. Returns null if none match.
public Entity TryGetChildByName(string name)
Parameters
name
string
Returns
TryGetComponent<T>(out T)
public bool TryGetComponent<T>(out T t) where T : Component
Parameters
t
T
Returns
Type Parameters
T
Unsafe_NetworkEntity(ulong)
Networks the entity, setting its network ID to the one passed in. This is a dangerous function and can break things if not used properly. Usually used in tandem with Scene.Unsafe_ServerGetNextNetworkId.
public void Unsafe_NetworkEntity(ulong networkId)
Parameters
networkId
ulong