Skip to content

Game.Prefabs.UITagPrefab

Assembly:
Assembly-CSharp (typical for game/mod assemblies)
Namespace: Game.Prefabs

Type:
public class

Base:
UITagPrefabBase

Summary:
UITagPrefab is a small component that overrides the uiTag property from its base class. It returns a local override string (m_Override) when that override is not null/whitespace; otherwise it falls back to the base.uiTag value. The class is annotated with a ComponentMenu attribute so it can be added via the Unity component menu under "UI/". The class relies on Colossal.OdinSerializer.Utilities for the IsNullOrWhitespace() extension method used to test the override string.


Fields

  • This class does not declare any new fields in this file.
    (It references m_Override, which is defined in the base class.)

Properties

  • public override string uiTag { get; }
    Returns the effective UI tag for this prefab. If the instance's m_Override string is not null or whitespace, that override string is returned. Otherwise the property returns the value of base.uiTag.

Notes: - The check uses Colossal.OdinSerializer.Utilities.IsNullOrWhitespace() extension to determine whether m_Override should be used. - m_Override is expected to be a field on UITagPrefabBase.

Constructors

  • public UITagPrefab()
    No explicit constructor is defined in the source file; the default parameterless constructor is used (no special initialization).

Methods

  • get uiTag() : string
    The overridden getter implements the behavior described in Properties: return m_Override if it is not null/whitespace; otherwise return base.uiTag.

Usage Example

// Assuming 'gameObject' has a UITagPrefab component (or a prefab instance)
var uiTagComponent = gameObject.GetComponent<Game.Prefabs.UITagPrefab>();
if (uiTagComponent != null)
{
    string tag = uiTagComponent.uiTag;
    // use tag for lookup, identification, etc.
}

Additional notes: - Because the class is a lightweight override, any customization is expected to be done via the m_Override field (defined on the base) or by changing the base.uiTag implementation. - The ComponentMenu attribute ([ComponentMenu("UI/", new Type[] { })]) places the component under the "UI/" menu in Unity's Add Component UI, which can help designers add this prefab component in the editor.