Game.UIToolbarGroupPrefab
Assembly:
Namespace: Game.Prefabs
Type: public class
Base: UIGroupPrefab
Summary:
Represents a UI toolbar group prefab used by the game's UI prefab system. This prefab exposes an integer priority (m_Priority) that is written into the runtime component UIToolbarGroupData during prefab initialization. The class registers the UIToolbarGroupData component type so the entity created from this prefab receives the necessary component at creation/initialization time.
Fields
public int m_Priority
Priority value for the toolbar group. This value is copied into the UIToolbarGroupData component during LateInitialize so systems that read UIToolbarGroupData can determine the toolbar group's ordering or importance.
Properties
- (none)
This prefab does not declare any C# properties. It exposes the priority directly as a public field.
Constructors
public UIToolbarGroupPrefab()
The default parameterless constructor is used by the prefab system / Unity to instantiate the prefab class. No custom construction logic is defined in this class.
Methods
-
public override void GetPrefabComponents(HashSet<ComponentType> components)
Adds required ECS component types for entities created from this prefab. Implementation calls the base class to collect base components and then adds ComponentType.ReadWrite() so the entity will contain a writable UIToolbarGroupData component. -
public override void LateInitialize(EntityManager entityManager, Entity entity)
Performs late initialization on the created entity. Calls the base class version and then sets the UIToolbarGroupData component on the entity using the prefab's m_Priority value: entityManager.SetComponentData(entity, new UIToolbarGroupData { m_Priority = m_Priority });
Usage Example
// Example: setting up the prefab before the prefab system instantiates it.
var toolbarPrefab = new UIToolbarGroupPrefab();
toolbarPrefab.m_Priority = 50;
// Later, when the prefab system creates an Entity from this prefab it will call:
// toolbarPrefab.LateInitialize(entityManager, createdEntity);
// which will write the UIToolbarGroupData component with m_Priority = 50 onto the entity.