Skip to content

Game.Prefabs.PlaceableInfoviewItem

Assembly: Assembly-CSharp
Namespace: Game.Prefabs

Type: struct

Base: Unity.Entities.IBufferElementData

Summary:
A small ECS buffer element that represents an item shown in a "placeable" infoview (UI) list. It carries a reference to an Entity (the item) and an integer priority which can be used to influence ordering or selection. The struct is annotated with InternalBufferCapacity(1), which sets the inline capacity for the dynamic buffer on the entity to 1 before it spills into heap storage.


Fields

  • public Unity.Entities.Entity m_Item
    Holds the Entity corresponding to the placeable item (for example, a prefab or a spawned entity representing the placeable asset). Intended to be used by systems that build or display the infoview.

  • public System.Int32 m_Priority
    Integer priority value that consumers (UI or systems) can use to order or prefer one item over another. The exact semantic is determined by the code that reads this buffer; typically higher (or lower) values indicate stronger preference/ordering.

Properties

  • This struct defines no properties. It is a plain data container (IBufferElementData).

Constructors

  • public PlaceableInfoviewItem()
    No explicit constructors are defined; the default parameterless value-type constructor provided by C# applies. Initialize fields when adding to a buffer.

Methods

  • This struct defines no methods. It is purely a data container for use in DynamicBuffer.

Usage Example

// Example inside a SystemBase or other system context:
protected override void OnStartRunning()
{
    // Assume 'uiEntity' is an entity that holds the infoview buffer
    // and 'placeableEntity' is an entity representing a placeable item.
    var uiEntity = ...;
    var placeableEntity = ...;

    // Add a buffer to the UI entity if it doesn't already have one
    var buffer = EntityManager.GetBuffer<PlaceableInfoviewItem>(uiEntity);
    buffer.Add(new PlaceableInfoviewItem
    {
        m_Item = placeableEntity,
        m_Priority = 5
    });
}

Notes: - The attribute [InternalBufferCapacity(1)] configures the in-entity storage capacity for the buffer. When the number of elements exceeds this value, the buffer storage will allocate out-of-line memory. - Because this implements IBufferElementData, access it via DynamicBuffer (EntityManager/GetBuffer or in Entities.ForEach). - Keep usage thread-safety and job access rules in mind when manipulating buffers from jobs/systems in the Unity DOTS environment.