Game.Events.AddEventJournalData
Assembly:
{{ Assembly not specified in source (likely part of the game's runtime/mod assembly) }}
Namespace:
Game.Events
Type:
struct (public) — value type implementing Unity.Entities.IComponentData and Unity.Entities.IQueryTypeParameter
Base:
System.ValueType (implements IComponentData, IQueryTypeParameter)
Summary:
A simple component/data container used to request or record changes to an event journal. Instances carry a reference to the event entity, a tracking type describing how the event should be recorded, and a count (quantity) to add. Because it implements IComponentData it can be attached to entities and processed by ECS systems; implementing IQueryTypeParameter signals it may be used as a query parameter type in some query patterns.
Fields
-
public EventDataTrackingType m_Type
{{ The kind of tracking to apply for this event. Expected to be an enum or similar type that indicates how the event should be recorded/tracked (for example: Add, Remove, Incremental, Snapshot). The exact values are defined by EventDataTrackingType in the codebase. }} -
public Entity m_Event
{{ The Entity that identifies the event being recorded/modified. This is an ECS Entity reference; systems consuming this component will resolve the event data from that entity. Ensure the referenced entity exists and is valid when the component is processed. }} -
public int m_Count
{{ The numeric count associated with the event — typically how many occurrences to add to the journal. Defaults to 1 in the provided constructor. Can be positive or, if semantics allow, negative to decrement (depending on how consuming systems interpret it). }}
Properties
- This type declares no properties.
{{ All data is exposed as public fields so the struct stays blittable and suitable for ECS usage. }}
Constructors
public AddEventJournalData(Entity eventEntity, EventDataTrackingType type, int count = 1)
{{ Creates a new instance of AddEventJournalData, initializing the event reference, tracking type, and count. Use this constructor when adding the component to an entity or creating a temporary instance to pass into a system or job. The default count is 1 for a single occurrence. }}
Methods
- This type defines no methods.
{{ It is a plain data container. Behavior and processing are implemented by ECS systems that read this component. }}
Usage Example
// Example in a SystemBase or other place with access to an EntityManager / EntityCommandBuffer:
// Create an AddEventJournalData instance and attach it to a requester entity so a system will process it:
Entity eventEntity = /* obtain or create the event entity */;
EventDataTrackingType trackingType = EventDataTrackingType.Add; // example enum value
int count = 2;
var addEvent = new Game.Events.AddEventJournalData(eventEntity, trackingType, count);
// Using EntityManager (immediate):
entityManager.AddComponentData(requestorEntity, addEvent);
// Or using an EntityCommandBuffer (deferred, e.g., in a job or multithreaded context):
ecb.AddComponent(requestorEntity, addEvent);
// Typical system responsibility:
// - A journaling system will query for entities with AddEventJournalData,
// read m_Event / m_Type / m_Count, update the event journal accordingly,
// and then remove or clear the AddEventJournalData component.
{{ Notes: - Because this is an IComponentData struct it must remain blittable; prefer public fields instead of properties. - Validate the referenced Entity (m_Event) before using it in systems to avoid processing invalid references. - The semantics of EventDataTrackingType and how m_Count is interpreted are determined by the consuming event-journal systems in the codebase. }}