Game.Prefabs.UIShortcut
Assembly: Assembly-CSharp
Namespace: Game.Prefabs
Type: class
Base: ComponentBase
Summary:
UIShortcut is a small prefab component used by the game's UI system to reference a UIInputAction (from Game.Input). The class exposes a public field m_Action which is intended to be set to an input-action asset/definition used by the UI. It overrides two ComponentBase methods (GetPrefabComponents and GetArchetypeComponents) but both implementations are empty in the decompiled/source file provided — meaning this prefab, as-is, does not add any additional ECS component types to prefab archetypes. Modders can extend these methods to include ECS component types that should be present on spawned entities for this prefab.
Fields
public Game.Input.UIInputAction m_Action
Holds a reference to a UIInputAction object (defined in Game.Input). Typically assigned in the prefab inspector to indicate which input action this shortcut corresponds to. This is a plain managed reference (not an ECS component).
Properties
- (none)
Constructors
public UIShortcut()
No explicit constructor is defined in the source; the default parameterless constructor is used. Initialization (if required) should be done via Unity lifecycle or by overriding ComponentBase methods.
Methods
-
public override void GetPrefabComponents(System.Collections.Generic.HashSet<Unity.Entities.ComponentType> components)
Override intended to add ComponentType entries to the provided set so that the prefab's archetype includes those ECS components when instantiated. In the shipped source this method is empty — the UIShortcut prefab does not add any ECS components by default. -
public override void GetArchetypeComponents(System.Collections.Generic.HashSet<Unity.Entities.ComponentType> components)
Similar to GetPrefabComponents: intended to populate archetype component types for this prefab. Also empty in the provided implementation.
Usage Example
// Example: assign the input action in the inspector (no code needed).
// If you want this prefab to add ECS components when converted, override the method:
using System.Collections.Generic;
using Unity.Entities;
using Game.Prefabs;
using Game.Input;
public class MyCustomUIShortcut : UIShortcut
{
public override void GetPrefabComponents(HashSet<ComponentType> components)
{
base.GetPrefabComponents(components);
// Example: ensure a custom ECS tag/component exists on the prefab's entities
components.Add(ComponentType.ReadWrite<MyCustomUITag>());
}
public override void GetArchetypeComponents(HashSet<ComponentType> components)
{
base.GetArchetypeComponents(components);
// Add other component types needed by systems at runtime
components.Add(ComponentType.ReadWrite<MyCustomUIState>());
}
}
Notes for modders: - m_Action is a managed reference and will not automatically become an ECS component. If you need ECS-side data derived from the referenced UIInputAction, add appropriate ECS components in GetPrefabComponents/GetArchetypeComponents and ensure conversion logic copies/links the data. - Because the provided implementations are empty, adding functionality requires creating a derived class or editing the prefab conversion process.