Skip to content

Game.Prefabs.UIAvatarColorData

Assembly: Assembly-CSharp
Namespace: Game.Prefabs

Type: struct

Base: Unity.Entities.IBufferElementData

Summary:
UIAvatarColorData is an ECS buffer element type that holds a single UnityEngine.Color32 value. It's intended to be used as elements in a DynamicBuffer on an Entity to store avatar/UI color entries (for example, a palette or list of color variants). As a value-type buffer element it is suitable for use with Unity DOTS/ECS (blittable/simple data).


Fields

  • public UnityEngine.Color32 m_Color
    Holds the RGBA color for this buffer element. Color32 stores 4 bytes (r,g,b,a). This field is the primary payload of this buffer element and is used when reading/writing color entries from a DynamicBuffer.

Properties

  • This type defines no properties. Use the public field m_Color directly when reading or writing values.

Constructors

  • public UIAvatarColorData(UnityEngine.Color32 color)
    Constructs a UIAvatarColorData instance and sets m_Color to the provided color. Useful for adding new entries into a DynamicBuffer.

Methods

  • This type defines no methods. It is a plain data container implementing IBufferElementData.

Usage Example

// Add a DynamicBuffer<UIAvatarColorData> to an entity and populate it
var entityManager = Unity.Entities.World.DefaultGameObjectInjectionWorld.EntityManager;
var entity = entityManager.CreateEntity();

// Ensure the entity has a buffer of UIAvatarColorData
var buffer = entityManager.AddBuffer<Game.Prefabs.UIAvatarColorData>(entity);

// Add some colors
buffer.Add(new Game.Prefabs.UIAvatarColorData(new UnityEngine.Color32(255, 0, 0, 255)));   // Red
buffer.Add(new Game.Prefabs.UIAvatarColorData(new UnityEngine.Color32(0, 255, 0, 255)));   // Green
buffer.Add(new Game.Prefabs.UIAvatarColorData(new UnityEngine.Color32(0, 0, 255, 255)));   // Blue

// Read/modify
for (int i = 0; i < buffer.Length; i++)
{
    UnityEngine.Color32 c = buffer[i].m_Color;
    // modify c if needed and write back
    // buffer[i] = new Game.Prefabs.UIAvatarColorData(modifiedColor);
}

Additional notes: - Because this implements Unity.Entities.IBufferElementData, it is intended for use with EntityManager/GetBuffer, archetypes, or systems that operate on DynamicBuffer. - Color32 is compact (4 bytes) and efficient for transmission/storage in ECS buffers.