Skip to content

Game.Triggers.ChirpLink

Assembly: Game (Game.dll)
Namespace: Game.Triggers

Type: struct

Base: IBufferElementData, Colossal.Serialization.Entities.ISerializable

Summary:
Represents a serializable buffer element that stores a reference to a "chirp" Entity. Intended for use with Unity's ECS DynamicBuffer systems (IBufferElementData) and Colossal's serialization framework (ISerializable) so the buffer contents can be persisted and restored by the game's serialization pipeline.


Fields

  • public Unity.Entities.Entity m_Chirp
    Holds an Entity reference that identifies the associated chirp. This is the data carried by the buffer element and is the value written/read during serialization.

Properties

  • (none)

Constructors

  • public ChirpLink()
    Implicit default struct constructor. Initializes the struct with default (zero) values; m_Chirp will be the default Entity value unless set explicitly.

Methods

  • public void Deserialize<TReader>(TReader reader) where TReader : IReader
    Reads the stored Entity value from the provided reader and assigns it to m_Chirp. Used by the Colossal serialization system when loading/pasting data.

  • public void Serialize<TWriter>(TWriter writer) where TWriter : IWriter
    Writes the current m_Chirp value to the provided writer. Used by the Colossal serialization system when saving/serializing data.

Usage Example

// Adding a ChirpLink to an entity's dynamic buffer
EntityManager em = World.DefaultGameObjectInjectionWorld.EntityManager;
Entity myEntity = em.CreateEntity();

// Assume chirpEntity is an existing Entity representing the chirp
Entity chirpEntity = /* obtain or create chirp entity */;

DynamicBuffer<Game.Triggers.ChirpLink> buffer = em.AddBuffer<Game.Triggers.ChirpLink>(myEntity);
buffer.Add(new Game.Triggers.ChirpLink { m_Chirp = chirpEntity });

// Example of what serialization uses internally (conceptual):
// writer.Write(chirpLink.m_Chirp);
// reader.Read(out chirpLink.m_Chirp);