Game.Prefabs.PlaceholderObjectElement
Assembly: Assembly-CSharp.dll
Namespace: Game.Prefabs
Type: public struct PlaceholderObjectElement : Unity.Entities.IBufferElementData
Base: System.ValueType (struct); implements Unity.Entities.IBufferElementData
Summary:
A lightweight ECS dynamic buffer element that stores a reference to an Entity used as a "placeholder" object for prefabs. The struct is marked with [InternalBufferCapacity(0)], indicating no inline storage for elements and that buffer memory is allocated separately. Use this element type when you need to maintain a list of placeholder Entities on an Entity via a DynamicBuffer
Fields
public Unity.Entities.Entity m_Object
Holds the Entity reference for the placeholder object. This is the value stored per buffer element and typically refers to an Entity representing a temporary or placeholder instance related to a prefab.
Properties
- None.
This struct defines no properties.
Constructors
public PlaceholderObjectElement(Unity.Entities.Entity obj)
Initializes a new buffer element with the provided Entity reference (sets m_Object = obj).
Methods
- None.
This struct contains only a field and a constructor; there are no methods defined.
Usage Example
// Assume 'entityManager' and entities already exist.
var entityWithBuffer = /* an Entity that should hold the buffer */;
var placeholderEntity = /* an Entity used as a placeholder */;
// Add the buffer to the entity if it doesn't exist, then add an element:
if (!entityManager.HasComponent<PlaceholderObjectElement>(entityWithBuffer))
{
entityManager.AddBuffer<PlaceholderObjectElement>(entityWithBuffer);
}
var buffer = entityManager.GetBuffer<PlaceholderObjectElement>(entityWithBuffer);
buffer.Add(new PlaceholderObjectElement(placeholderEntity));