Game.IconDefinition
Assembly: Game
Namespace: Game.Tools
Type: struct
Base: Implements Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter
Summary:
IconDefinition is a small, blittable ECS component that stores the data required to represent a notification icon in the entity-component system. It is a plain-data wrapper copying values from a Game.Notifications.Icon instance so icon data can be attached to Entities and processed by ECS systems (filters, jobs, systems). The struct contains position, priority, clustering layer and flag metadata used by icon rendering/management systems.
Fields
-
public Unity.Mathematics.float3 m_Location
Stores the icon's world (or relevant) position as a float3. This is typically the location used by rendering/placement systems to display the icon. -
public IconPriority m_Priority
Priority enum/value used to determine ordering or importance of icons (higher priority may render above or be preferred during clustering/selection). Defined in Game.Notifications. -
public IconClusterLayer m_ClusterLayer
Indicates the clustering layer/group for the icon. Clustering systems use this to group icons that should be combined or managed together. -
public IconFlags m_Flags
Bitflags or enum set that carries additional icon properties (visibility flags, behavior modifiers, etc.). Defined in Game.Notifications.
Properties
- None.
This type exposes only public fields and has no C# properties.
Constructors
public IconDefinition(Icon icon)
Constructs an IconDefinition by copying values from a Game.Notifications.Icon instance. This is the convenient way to convert the game's Notification-centric Icon representation into an ECS component that can be attached to an Entity.
Methods
- None.
The struct contains no methods beyond the provided constructor; it is intended as a POD component for ECS usage and is safe to pass into jobs and storage.
Usage Example
using Unity.Entities;
using Unity.Mathematics;
using Game.Tools;
using Game.Notifications;
// Example: converting a notification Icon into an ECS component and adding it to an entity
Icon notifIcon = new Icon {
m_Location = new float3(10f, 0f, 5f),
m_Priority = IconPriority.High,
m_ClusterLayer = IconClusterLayer.Default,
m_Flags = IconFlags.Visible
};
IconDefinition iconDef = new IconDefinition(notifIcon);
// Using an EntityManager to add the component to an existing entity
EntityManager entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
Entity entity = entityManager.CreateEntity(); // or obtain an existing entity
entityManager.AddComponentData(entity, iconDef);
// In a system, you can query for IconDefinition to process icons:
Entities.ForEach((ref IconDefinition icon) =>
{
// read icon.m_Location, icon.m_Priority, etc.
}).Schedule();
Notes: - Because IconDefinition implements IComponentData, it is suitable for use as a component in Unity's ECS (Entities) and can be stored in component chunks and accessed from jobs. - Implementing IQueryTypeParameter allows the type to be used in certain query helpers and may be leveraged by the codebase's query utilities.