Skip to content

Game.Prefabs.UIMultiTagPrefab

Assembly:
Namespace: Game.Prefabs

Type: class

Base: PrefabBase

Summary:
UIMultiTagPrefab is a Prefab class used by the Tutorials system to provide multiple UI tags from a single prefab. It can either return a single override tag (m_Override) or combine the uiTag values of multiple PrefabBase providers (m_UITagProviders) into a pipe-delimited string. The provided tags are treated as separate but hierarchically equal by the Tutorials system.


Fields

  • public string m_Override
    Used to explicitly override the generated UI tag. If set (non-null and not whitespace), its value is returned by the uiTag property instead of generating one from providers. The field is annotated with [CanBeNull] and has a Tooltip in the original class.

  • public PrefabBase[] m_UITagProviders
    Array of PrefabBase references whose uiTag values will be combined when m_Override is not provided. Used to allow a single prefab to represent multiple UI tags for Tutorials, Tutorial Phases and Tutorial Triggers.

Properties

  • public override string uiTag { get; }
    Returns the UI tag for this prefab. Behavior:
  • If m_Override is non-empty (not null/whitespace), returns m_Override.
  • If m_UITagProviders is null, returns base.uiTag (the default behavior from PrefabBase).
  • Otherwise returns a single string that joins each provider's uiTag with a '|' character (e.g., "tagA|tagB|tagC").

Constructors

  • public UIMultiTagPrefab()
    No explicit constructor is declared in the source; the class uses the default parameterless constructor provided by C#. Instances are typically created/managed by the game's prefab system rather than manually constructed.

Methods

  • public override void GetDependencies(System.Collections.Generic.List<PrefabBase> prefabs)
    Overrides PrefabBase.GetDependencies. Calls the base implementation and, if m_UITagProviders is not null, adds each element of m_UITagProviders to the provided prefabs list so the game knows these prefabs are dependencies.

  • public override void GetPrefabComponents(System.Collections.Generic.HashSet<Unity.Entities.ComponentType> prefabComponents)
    Overrides PrefabBase.GetPrefabComponents. Calls the base implementation and then adds a read/write ComponentType entry for UITagPrefabData:

  • prefabComponents.Add(ComponentType.ReadWrite());

Usage Example

// Example: combining tags from two existing PrefabBase providers.
var multi = ScriptableObject.CreateInstance<Game.Prefabs.UIMultiTagPrefab>();
multi.m_Override = null; // don't override
multi.m_UITagProviders = new PrefabBase[] { providerA, providerB }; // providerA.uiTag = "Menu", providerB.uiTag = "Settings"

string combined = multi.uiTag; // "Menu|Settings"

// If you want to force a single tag regardless of providers:
multi.m_Override = "CustomTag";
string single = multi.uiTag; // "CustomTag"

Additional notes: - The class is decorated with [ComponentMenu("UI/")] and uses Tooltips for fields to aid designers in the Unity editor. - This prefab contributes UITagPrefabData as a component requirement through GetPrefabComponents, which is relevant for the entity/prefab conversion systems in the game.