Game.Prefabs.PrefabUnlockedRequirement
Assembly: Assembly-CSharp
Namespace: Game.Prefabs
Type: struct
Base: System.ValueType, Unity.Entities.IBufferElementData
Summary:
A small ECS buffer element that holds a reference to another Entity used as an unlock requirement for a prefab. Instances of this struct are intended to be stored in a DynamicBuffer on a prefab entity to represent one prerequisite (another prefab or requirement entity) that must be satisfied/unlocked for the associated prefab to become available.
Fields
public Unity.Entities.Entity m_Requirement
Holds the Entity that represents the unlock requirement. This is a raw ECS Entity handle — to inspect or operate on the referenced entity you must use the EntityManager or appropriate ECS APIs. Multiple PrefabUnlockedRequirement elements can be stored in a DynamicBuffer to represent a list of prerequisites.
Properties
- None (this type is a plain buffer element struct; use fields directly)
Constructors
- Implicit default constructor (value-type default)
You can create instances with object initializer syntax: new PrefabUnlockedRequirement { m_Requirement = someEntity }
Methods
- None (no methods defined)
Usage Example
using Unity.Entities;
// Add a requirement to a prefab entity (e.g. inside a SystemBase or using EntityManager)
Entity prefabEntity = /* the prefab entity */;
Entity requirementEntity = /* the entity that must be unlocked first */;
var buffer = EntityManager.GetBuffer<PrefabUnlockedRequirement>(prefabEntity);
buffer.Add(new PrefabUnlockedRequirement { m_Requirement = requirementEntity });
// Reading requirements:
var reqBuffer = EntityManager.GetBuffer<PrefabUnlockedRequirement>(prefabEntity);
foreach (var req in reqBuffer)
{
Entity reqEntity = req.m_Requirement;
// check EntityManager.Exists(reqEntity) or inspect components to evaluate the requirement
}
Notes:
- This element is intended for use with Unity's DOTS/ECS DynamicBuffer system (DynamicBuffer