Entity extension type

Represents an entity (temporary runtime pointer) in the game world. Do not confuse with PersistentEntity

Unsafe to save, since it will be regenerated at the game start.

Contains generation and location information.

Entity is packed as a single 64-bit integer:

  • Lower 32 bits: index
  • Upper 32 bits: generation

To understand ECS better, refer to Bevy docs.

on

Constructors

Entity({EntityIndex index = EntityIndex.zero, EntityGeneration generation = EntityGeneration.zero})
Represents an entity (temporary runtime pointer) in the game world. Do not confuse with PersistentEntity
factory
Entity.create([int index = 0, int generation = 0])
factory

Properties

generation EntityGeneration
Extract generation (upper 32 bits)
no setter
index EntityIndex
Get EntityIndex wrapper
no setter
indexValue int
Extract index (lower 32 bits)
no setter
isNotNull bool
no setter
isNull bool
no setter
isZero bool
no setter
value int
final

Methods

entityToString() String
toJson() String
whenNullUse(Entity other) Entity

Constants

nullEntity → const Entity