Skip to content

Game.Triggers.LifePathEntry

Assembly: Assembly-CSharp
Namespace: Game.Triggers

Type: struct

Base: IBufferElementData, ISerializable

Summary:
LifePathEntry is a small ECS buffer element used to store a reference to a Unity.Entities.Entity that participates in "life path" triggers. It implements Colossal's serialization interfaces so it can be written/read via the game's custom (de)serialization system and can be stored in a DynamicBuffer on an Entity for efficient per-entity lists.


Fields

  • public Unity.Entities.Entity m_Entity
    Holds the Entity reference associated with this life-path entry. Public so it can be accessed directly in Jobs and systems.

Properties

  • This type does not expose any properties.

Constructors

  • public LifePathEntry(Unity.Entities.Entity entity)
    Initializes the struct with the provided Entity reference.

Methods

  • public void Serialize<TWriter>(TWriter writer) where TWriter : IWriter
    Writes the m_Entity field using the provided writer. Used by the game's serialization pipeline to persist this buffer element.

  • public void Deserialize<TReader>(TReader reader) where TReader : IReader
    Reads the m_Entity field from the provided reader. Used by the game's deserialization pipeline to restore this buffer element.

Usage Example

// Add a LifePathEntry to a DynamicBuffer on an entity
void AddLifePathEntry(EntityManager entityManager, Entity owner, Entity target)
{
    var buffer = entityManager.GetBuffer<LifePathEntry>(owner);
    buffer.Add(new LifePathEntry(target));
}

// During serialization/deserialization the framework will call Serialize/Deserialize
// on each LifePathEntry in a buffer automatically (assuming it's wired into the game's serializer).