Skip to content

Game.Prefabs.TriggerConditionData

Assembly: Assembly-CSharp.dll
Namespace: Game.Prefabs

Type: struct

Base: System.ValueType, Unity.Entities.IBufferElementData

Summary:
TriggerConditionData is a small ECS buffer element that represents a single trigger condition used by prefab logic. It stores the condition type (an enum) and a numeric value (typically a threshold). The struct is marked [Serializable] so it can appear in serialized prefab data and implements IBufferElementData so multiple conditions can be stored in a DynamicBuffer on an entity (for example, a prefab entity storing a list of trigger checks).


Fields

  • public TriggerConditionType m_Type
    Specifies the kind of condition to evaluate. TriggerConditionType is an enum defined elsewhere in the codebase; it typically encodes comparison or trigger kinds (e.g., greater-than, less-than, equal, flags, etc.). Check the enum definition for available values and semantics.

  • public float m_Value
    Numeric value associated with the condition. Commonly used as a threshold or comparison value for the condition specified by m_Type.

Properties

  • None (this is a plain data struct with public fields).

Constructors

  • public TriggerConditionData()
    Default value-type constructor provided by C#. You can also initialize instances using an object initializer, e.g.: new TriggerConditionData { m_Type = TriggerConditionType.YourType, m_Value = 1.0f };

Methods

  • None (no instance or static methods defined).

Usage Example

using Unity.Entities;
using Game.Prefabs;

// Example: creating an entity and populating a DynamicBuffer<TriggerConditionData>
var world = World.DefaultGameObjectInjectionWorld;
var em = world.EntityManager;

// Create an entity (or obtain an existing prefab entity)
var entity = em.CreateEntity();

// Add a buffer to hold trigger conditions
var buffer = em.AddBuffer<TriggerConditionData>(entity);

// Add conditions to the buffer
buffer.Add(new TriggerConditionData { m_Type = TriggerConditionType.GreaterThan, m_Value = 10f });
buffer.Add(new TriggerConditionData { m_Type = TriggerConditionType.LessThan, m_Value = 5f });

// Later, systems can read this buffer and evaluate each TriggerConditionData element.

Note: Replace TriggerConditionType enum values with the actual members defined in your project. This struct is intended for use with Unity's DOTS/ECS workflows (DynamicBuffer, chunked components, systems).