Game.UI.Widgets.IUITagProvider
Assembly:
Assembly-CSharp
Namespace: Game.UI.Widgets
Type:
Interface
Base:
None (interface)
Summary:
Provides a simple contract for UI widgets to expose a string tag (uiTag). Implementations typically use this tag for identification, grouping, lookup, styling or analytics within the UI system. The interface only defines the property; storage/serialization is left to the implementer.
Fields
- This interface defines no fields.
Provides no storage; implementers should use their own backing fields if needed.
Properties
public System.String uiTag { get; set; }
A get/set property representing the tag for the UI element. Implementers can expose this for runtime changes or persist it using a serialized backing field if the value should be editable in the Unity inspector.
Constructors
- Interfaces do not define constructors.
Concrete types implementing this interface provide their own construction/initialization.
Methods
- This interface does not declare methods.
It only contains the single uiTag property.
Usage Example
using UnityEngine;
using Game.UI.Widgets;
public class MyWidget : MonoBehaviour, IUITagProvider
{
// Unity cannot serialize properties directly, so use a backing field to expose in the inspector.
[SerializeField] private string _uiTag = "DefaultTag";
public string uiTag
{
get => _uiTag;
set => _uiTag = value;
}
void Start()
{
// Example: find other UI elements by tag (pseudo-usage)
var provider = GetComponent<IUITagProvider>();
if (provider != null)
{
Debug.Log("This widget's UI tag is: " + provider.uiTag);
provider.uiTag = "ToolbarButton";
}
}
}
Additional notes: - If you want uiTag editable in the Unity inspector, use a serialized backing field as shown. - Use consistent tag values across your UI so systems that query IUITagProvider can reliably find and group widgets.