Game.Prefabs.PolicyData
Assembly: Assembly-CSharp (game code)
Namespace: Game.Prefabs
Type: struct
Base: Implements Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter
Summary:
PolicyData is a small Unity DOTS/IComponentData struct used by the game to associate a numeric visibility/state value with a prefab (policy-related data). It is a plain data component (no behavior) intended to be attached to entities so systems can read or modify policy visibility/state. The exact meaning/encoding of the integer is defined by the game's systems; by default an uninitialized int will be 0.
Fields
public int m_Visibility
Holds the policy visibility/state value. Default (uninitialized) is 0. Systems or UI code read and write this field to determine or change the visibility/activation state of the associated policy. Use EntityManager or ECS queries to set or inspect this value.
Properties
- None
Constructors
public PolicyData()
Default implicit struct constructor. Create instances using the default constructor or an object initializer: new PolicyData { m_Visibility = 1 }
Methods
- None (this is a plain data component with no members beyond the field)
Usage Example
// Example: add PolicyData to an entity and set visibility
EntityManager.AddComponentData(entity, new PolicyData { m_Visibility = 1 });
// Example: SystemBase reading and updating PolicyData
public partial class PolicyVisibilitySystem : SystemBase
{
protected override void OnUpdate()
{
Entities
.WithAll<PolicyData>()
.ForEach((ref PolicyData policy) =>
{
// read visibility
int v = policy.m_Visibility;
// modify if needed
if (v == 0)
policy.m_Visibility = 1;
})
.ScheduleParallel();
}
}