Game.Prefabs.UICompositeTagPrefab
Assembly:
Namespace: Game.Prefabs
Type: class
Base: UITagPrefabBase
Summary:
A prefab component that produces a single composite UI tag by concatenating the uiTag values of multiple PrefabBase providers. Intended for use with the Tutorials system where multiple tags should be treated as one logical tag. Has a ComponentMenu attribute ("UI/") and exposes an array of providers editable in the inspector.
Fields
public PrefabBase[] m_UITagProviders
Array of PrefabBase objects whose uiTag values are used to build the composite tag. The tags are concatenated in array order with a "+" separator. Can be null; when null the component falls back to the base class uiTag behavior. A tooltip on this field notes its use by the Tutorials system.
Properties
public override string uiTag { get; }
Returns the prefab's effective UI tag. Behavior:- If an override string (m_Override, from the base class) is set and not whitespace, that override is returned.
- If m_UITagProviders is null, returns base.uiTag.
- Otherwise returns the concatenation of each provider's uiTag joined with "+" (string.Join("+", providers.Select(t => t.uiTag))). Uses Colossal.OdinSerializer.Utilities extension IsNullOrWhitespace to check the override.
Constructors
public UICompositeTagPrefab()
No explicit constructor is defined in the source; the default parameterless constructor is used. Initialization and editor-assigned fields (like m_UITagProviders) are handled by Unity/serialization.
Methods
public override void GetDependencies(List<PrefabBase> prefabs)
Adds this prefab's dependencies to the provided list:- Calls base.GetDependencies(prefabs) first.
- If m_UITagProviders is not null, iterates the array and adds each element to prefabs. This ensures any referenced PrefabBase items are considered dependencies (useful for loading/serialization/order resolution).
Usage Example
// Example usage inside a custom prefab or editor setup:
public class ExampleUsage : MonoBehaviour
{
public UICompositeTagPrefab compositeTagPrefab;
void Start()
{
// Assume compositeTagPrefab.m_UITagProviders is assigned in inspector
Debug.Log("Composite UI Tag: " + compositeTagPrefab.uiTag);
// If providers have tags "A", "B" and "C", the result will be "A+B+C"
}
}
Notes: - If you need the composite tag to be treated as a single tag by tutorial logic, assign the relevant UI element prefabs to m_UITagProviders in the inspector. - The class relies on PrefabBase.uiTag and the base UITagPrefabBase implementation (including m_Override), so ensure compatibility when extending or replacing those base types.