Skip to content

Game.Prefabs.AreaNameData

Assembly: Game
Namespace: Game.Prefabs

Type: struct

Base: System.ValueType, Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter

Summary:
AreaNameData is a small ECS component (value type) used to store color information for area name labels. It contains two Color32 fields: one for the normal (unselected) color and one for the selected color. A static GetDefaults() helper returns a recommended default palette (mid-gray with semi-transparent normal alpha and fully opaque selected alpha). This component is intended to be attached to entities/prefabs that need to render or style area name text in the game UI/world.


Fields

  • public UnityEngine.Color32 m_Color
    Holds the default/unselected color for the area name text. In GetDefaults() this is set to (128,128,128,128) — a mid-gray with 50% alpha.

  • public UnityEngine.Color32 m_SelectedColor
    Holds the color used when the area name is selected or highlighted. In GetDefaults() this is set to (128,128,128,255) — same mid-gray but fully opaque.

Properties

  • None.
    This struct exposes public fields and a static factory method rather than properties.

Constructors

  • Implicit parameterless struct constructor (public AreaNameData())
    As a C# struct, it has an implicit parameterless constructor that initializes fields to their default values (Color32 default is (0,0,0,0)). Use GetDefaults() to obtain the typical initialized values used by the game.

Methods

  • public static AreaNameData GetDefaults() : Game.Prefabs.AreaNameData
    Returns an AreaNameData initialized with the recommended default colors:
  • m_Color = Color32(128, 128, 128, 128)
  • m_SelectedColor = Color32(128, 128, 128, 255)
    Use this to quickly obtain a standard color set for area name components.

Usage Example

using Unity.Entities;
using UnityEngine;
using Game.Prefabs;

// Create an entity with the AreaNameData component and set the default colors
var entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
var archetype = entityManager.CreateArchetype(typeof(AreaNameData));
var entity = entityManager.CreateEntity(archetype);

// Apply recommended defaults
entityManager.SetComponentData(entity, AreaNameData.GetDefaults());

// Or create a custom color set
var custom = AreaNameData.GetDefaults();
custom.m_Color = new Color32(200, 100, 50, 200);
custom.m_SelectedColor = new Color32(255, 200, 150, 255);
entityManager.SetComponentData(entity, custom);