Skip to content

Game.Tutorials.ITutorialUIActivationSystem

Assembly: Assembly-CSharp (inferred)
Namespace: Game.Tutorials

Type: Interface

Base: None (interface)

Summary:
{{ The ITutorialUIActivationSystem interface defines a contract for systems that activate or deactivate tutorial-related UI elements by a string tag. Implementations are responsible for locating the UI element(s) associated with the provided tag and setting their active state. This is typically used by the tutorial manager or other tutorial-related logic to show/hide UI prompts, highlights, or overlays. Implementations are expected to handle null/missing targets gracefully and perform any required main-thread / Unity object interaction safely. }}


Fields

  • None
    {{ This interface does not declare any fields. }}

Properties

  • None
    {{ This interface does not declare any properties. }}

Constructors

  • None
    {{ Interfaces do not have constructors. Implementing types provide construction/initialization as needed. }}

Methods

  • void SetTag(string tag, bool active)
    {{ Sets the activation state of UI elements identified by the given tag. Parameter "tag" identifies which tutorial UI elements to target (implementation-specific — could be a GameObject tag, a custom identifier, or a key into a map of UI widgets). Parameter "active" indicates whether the target UI elements should be shown (true) or hidden (false). Implementations should:
  • Validate the tag (handle null/empty).
  • Locate one or more UI elements corresponding to the tag.
  • Toggle their active/visible state on the Unity main thread (if manipulating GameObjects or UI components).
  • Fail gracefully if no elements are found (log a warning or silently ignore, depending on design).
  • Optionally support batching or deferred updates if many updates are expected. }}

Usage Example

using UnityEngine;
using Game.Tutorials;

public class TutorialUIActivationSystem : ITutorialUIActivationSystem
{
    // Example simple implementation that finds a GameObject by tag
    public void SetTag(string tag, bool active)
    {
        if (string.IsNullOrEmpty(tag))
        {
            Debug.LogWarning("SetTag called with null or empty tag.");
            return;
        }

        // FindWithTag will throw if no object has the tag in some contexts,
        // so we try/catch or use GameObject.Find and check for null in real implementations.
        try
        {
            var go = GameObject.FindWithTag(tag);
            if (go != null)
            {
                go.SetActive(active);
            }
            else
            {
                // No object found for that tag — handle appropriately
                Debug.Log($"No tutorial UI object found for tag '{tag}'.");
            }
        }
        catch (UnityException)
        {
            // Fallback safe handling if the tag doesn't exist in the tag manager.
            Debug.Log($"Tag '{tag}' may not be defined in Tags and Layers.");
        }
    }
}

{{ Implementation notes: prefer explicit mappings (Dictionary/UIElement) over relying on Unity tags for greater robustness. Ensure any Unity object manipulation happens on the main thread. If the tutorial system runs on a separate update/system loop, marshal calls back to Unity's main thread or schedule activation in the next frame. }}