Unravel Engine C# Reference
Loading...
Searching...
No Matches
Unravel.Core.Entity Struct Reference

Represents an entity within a scene. Provides methods to manage components and query entity properties. More...

Inheritance diagram for Unravel.Core.Entity:

Public Member Functions

void SetActive (bool active)
 
override bool Equals (object obj)
 
bool Equals (Entity other)
 Determines whether the specified entity is equal to the current entity.
 
override int GetHashCode ()
 
bool IsValid ()
 Determines whether the entity is valid within the scene.
 
T AddComponent< T > ()
 Adds a new component of the specified type to the entity.
 
bool HasComponent< T > ()
 Determines whether the entity has a component of the specified type.
 
bool HasComponent (Type type)
 Determines whether the entity has a component of the specified type.
 
T GetComponent< T > ()
 Gets the component of the specified type from the entity.
 
Component[] GetComponents (Type type)
 Gets all components of the specified type from the entity.
 
T[] GetComponents< T > ()
 Gets all components of the specified type from the entity.
 
T GetComponentInChildren< T > ()
 
T[] GetComponentsInChildren< T > ()
 Gets all components of the specified type from the entity and its children.
 
Component GetComponentInChildren (Type type)
 Gets the first component of the specified type from the entity or any of its children.
 
Component[] GetComponentsInChildren (Type type)
 Gets all components of the specified type from the entity and its children.
 
bool RemoveComponent< T > ()
 Removes a component of the specified type from the entity.
 
bool RemoveComponent< T > (float secondsDelay)
 Removes a component of the specified type from the entity.
 
override string ToString ()
 Converts the collision to its string representation.
 
string ToString (string format)
 Converts the collision to its string representation with a specified format.
 
string ToString (string format, IFormatProvider formatProvider)
 Converts the collision to its string representation with a specified format and format provider.
 

Static Public Member Functions

static bool operator== (Entity lhs, Entity rhs)
 Compares two entities for equality.
 
static bool operator!= (Entity lhs, Entity rhs)
 Compares two entities for inequality.
 
static implicit operator bool (Entity entity)
 Implicit conversion to bool for null checking. Returns true if the entity is valid.
 
static bool RemoveComponent (Component component)
 Removes a specified component instance from its owner.
 
static bool RemoveComponent (Component component, float secondsDelay)
 Removes a specified component instance from its owner.
 

Public Attributes

readonly uint Id
 Gets the unique identifier of the entity.
 

Static Public Attributes

static readonly Entity Invalid = new Entity(0)
 

Properties

bool active [get]
 Gets or sets the wether the entity is active.
 
bool activeLocal [get]
 
string name [get, set]
 Gets or sets the name of the entity.
 
string tag [get, set]
 Gets or sets the tag of the entity.
 
LayerMask layers [get, set]
 Gets or sets the layer of the entity.
 
TransformComponent transform [get]
 Gets the transform component of the entity.
 

Detailed Description

Represents an entity within a scene. Provides methods to manage components and query entity properties.

Definition at line 15 of file Entity.cs.

Member Function Documentation

◆ AddComponent< T >()

T Unravel.Core.Entity.AddComponent< T > ( )

Adds a new component of the specified type to the entity.

Template Parameters
TThe type of component to add.
Returns
The newly added component.
Type Constraints
T :Component 
T :new() 

Definition at line 147 of file Entity.cs.

◆ Equals() [1/2]

bool Unravel.Core.Entity.Equals ( Entity other)

Determines whether the specified entity is equal to the current entity.

Parameters
otherThe entity to compare with the current entity.
Returns
true if the specified entity is equal to the current entity; otherwise, false.

Definition at line 96 of file Entity.cs.

◆ Equals() [2/2]

override bool Unravel.Core.Entity.Equals ( object obj)

Definition at line 82 of file Entity.cs.

◆ GetComponent< T >()

T Unravel.Core.Entity.GetComponent< T > ( )

Gets the component of the specified type from the entity.

Template Parameters
TThe type of component to retrieve.
Returns
The component of the specified type.
Type Constraints
T :Component 
T :new() 

Definition at line 177 of file Entity.cs.

◆ GetComponentInChildren()

Component Unravel.Core.Entity.GetComponentInChildren ( Type type)

Gets the first component of the specified type from the entity or any of its children.

Parameters
typeThe component type to search for.

Definition at line 222 of file Entity.cs.

◆ GetComponentInChildren< T >()

Gets the first component of the specified type from the entity or any of its children.

Type Constraints
T :Component 

Definition at line 205 of file Entity.cs.

◆ GetComponents()

Component[] Unravel.Core.Entity.GetComponents ( Type type)

Gets all components of the specified type from the entity.

Parameters
typeThe type of component to retrieve.
Returns
An array of components of the specified type.

Definition at line 187 of file Entity.cs.

◆ GetComponents< T >()

Gets all components of the specified type from the entity.

Template Parameters
TThe type of component to retrieve.
Returns
An array of components of the specified type.
Type Constraints
T :Component 

Definition at line 197 of file Entity.cs.

◆ GetComponentsInChildren()

Component[] Unravel.Core.Entity.GetComponentsInChildren ( Type type)

Gets all components of the specified type from the entity and its children.

Parameters
typeThe component type to search for.

Definition at line 231 of file Entity.cs.

◆ GetComponentsInChildren< T >()

Gets all components of the specified type from the entity and its children.

Type Constraints
T :Component 

Definition at line 213 of file Entity.cs.

◆ GetHashCode()

override int Unravel.Core.Entity.GetHashCode ( )

◆ HasComponent()

bool Unravel.Core.Entity.HasComponent ( Type type)

Determines whether the entity has a component of the specified type.

Parameters
typeThe type of component to check for.
Returns
true if the entity has the specified component; otherwise, false.

Definition at line 167 of file Entity.cs.

◆ HasComponent< T >()

Determines whether the entity has a component of the specified type.

Template Parameters
TThe type of component to check for.
Returns
true if the entity has the specified component; otherwise, false.
Type Constraints
T :Component 

Definition at line 157 of file Entity.cs.

◆ IsValid()

bool Unravel.Core.Entity.IsValid ( )

Determines whether the entity is valid within the scene.

Returns
true if the entity is valid; otherwise, false.

Definition at line 137 of file Entity.cs.

◆ operator bool()

static implicit Unravel.Core.Entity.operator bool ( Entity entity)
static

Implicit conversion to bool for null checking. Returns true if the entity is valid.

Parameters
entityThe entity to check.
Returns
true if the entity is valid; otherwise, false.

Definition at line 125 of file Entity.cs.

◆ operator!=()

static bool Unravel.Core.Entity.operator!= ( Entity lhs,
Entity rhs )
static

Compares two entities for inequality.

Parameters
lhsThe first entity.
rhsThe second entity.
Returns
true if both entities are not equal; otherwise, false.

◆ operator==()

static bool Unravel.Core.Entity.operator== ( Entity lhs,
Entity rhs )
static

Compares two entities for equality.

Parameters
lhsThe first entity.
rhsThe second entity.
Returns
true if both entities are equal; otherwise, false.

◆ RemoveComponent() [1/2]

static bool Unravel.Core.Entity.RemoveComponent ( Component component)
static

Removes a specified component instance from its owner.

Parameters
componentThe component instance to remove.
Returns
true if the component was successfully removed; otherwise, false.

Definition at line 241 of file Entity.cs.

◆ RemoveComponent() [2/2]

static bool Unravel.Core.Entity.RemoveComponent ( Component component,
float secondsDelay )
static

Removes a specified component instance from its owner.

Parameters
componentThe component instance to remove.
Returns
true if the component was successfully removed; otherwise, false.

Definition at line 251 of file Entity.cs.

◆ RemoveComponent< T >() [1/2]

Removes a component of the specified type from the entity.

Template Parameters
TThe type of component to remove.
Returns
true if the component was successfully removed; otherwise, false.
Type Constraints
T :Component 

Definition at line 261 of file Entity.cs.

◆ RemoveComponent< T >() [2/2]

bool Unravel.Core.Entity.RemoveComponent< T > ( float secondsDelay)

Removes a component of the specified type from the entity.

Template Parameters
TThe type of component to remove.
Returns
true if the component was successfully removed; otherwise, false.
Type Constraints
T :Component 

Definition at line 271 of file Entity.cs.

◆ SetActive()

void Unravel.Core.Entity.SetActive ( bool active)

Definition at line 37 of file Entity.cs.

◆ ToString() [1/3]

override string Unravel.Core.Entity.ToString ( )

Converts the collision to its string representation.

Returns
A string that represents the collision.

Definition at line 280 of file Entity.cs.

◆ ToString() [2/3]

string Unravel.Core.Entity.ToString ( string format)

Converts the collision to its string representation with a specified format.

Parameters
formatThe format string.
Returns
A string that represents the collision.

Definition at line 290 of file Entity.cs.

◆ ToString() [3/3]

string Unravel.Core.Entity.ToString ( string format,
IFormatProvider formatProvider )

Converts the collision to its string representation with a specified format and format provider.

Parameters
formatThe format string.
formatProviderAn object that supplies culture-specific formatting information.
Returns
A string that represents the collision.

Definition at line 301 of file Entity.cs.

Member Data Documentation

◆ Id

readonly uint Unravel.Core.Entity.Id

Gets the unique identifier of the entity.

Definition at line 21 of file Entity.cs.

◆ Invalid

readonly Entity Unravel.Core.Entity.Invalid = new Entity(0)
static

Definition at line 17 of file Entity.cs.

Property Documentation

◆ active

bool Unravel.Core.Entity.active
get

Gets or sets the wether the entity is active.

The active state associated with the entity.

Definition at line 27 of file Entity.cs.

◆ activeLocal

bool Unravel.Core.Entity.activeLocal
get

Definition at line 32 of file Entity.cs.

◆ layers

LayerMask Unravel.Core.Entity.layers
getset

Gets or sets the layer of the entity.

The layer associated with the entity.

Definition at line 66 of file Entity.cs.

◆ name

string Unravel.Core.Entity.name
getset

Gets or sets the name of the entity.

The name associated with the entity.

Definition at line 46 of file Entity.cs.

◆ tag

string Unravel.Core.Entity.tag
getset

Gets or sets the tag of the entity.

The tag associated with the entity.

Definition at line 56 of file Entity.cs.

◆ transform

TransformComponent Unravel.Core.Entity.transform
get

Gets the transform component of the entity.

The transform component of the entity.

Definition at line 76 of file Entity.cs.


The documentation for this struct was generated from the following file: