Hex Terrains Framework
Search Results for

    Show / Hide Table of Contents

    Class UIManager

    Base class for MonoBehaviour component that controls UI screens. If you want it to collect all existing screens from scene, override IsCollectUIScreensFromSceneOnStart property IsCollectUIScreensFromSceneOnStart. Call an ApplyConfig() method to make the UI system be able to create screens by request (it uses prefabs copied from the list provided into this method) ApplyConfig(IList<UIScreen>).

    Inheritance
    object
    Object
    Component
    Behaviour
    MonoBehaviour
    UIManager
    Implements
    IUISystemAPI
    Inherited Members
    MonoBehaviour.IsInvoking()
    MonoBehaviour.CancelInvoke()
    MonoBehaviour.Invoke(string, float)
    MonoBehaviour.InvokeRepeating(string, float, float)
    MonoBehaviour.CancelInvoke(string)
    MonoBehaviour.IsInvoking(string)
    MonoBehaviour.StartCoroutine(string)
    MonoBehaviour.StartCoroutine(string, object)
    MonoBehaviour.StartCoroutine(IEnumerator)
    MonoBehaviour.StartCoroutine_Auto(IEnumerator)
    MonoBehaviour.StopCoroutine(IEnumerator)
    MonoBehaviour.StopCoroutine(Coroutine)
    MonoBehaviour.StopCoroutine(string)
    MonoBehaviour.StopAllCoroutines()
    MonoBehaviour.print(object)
    MonoBehaviour.destroyCancellationToken
    MonoBehaviour.useGUILayout
    MonoBehaviour.didStart
    MonoBehaviour.didAwake
    MonoBehaviour.runInEditMode
    Behaviour.enabled
    Behaviour.isActiveAndEnabled
    Component.GetComponent(Type)
    Component.GetComponent<T>()
    Component.TryGetComponent(Type, out Component)
    Component.TryGetComponent<T>(out T)
    Component.GetComponent(string)
    Component.GetComponentInChildren(Type, bool)
    Component.GetComponentInChildren(Type)
    Component.GetComponentInChildren<T>(bool)
    Component.GetComponentInChildren<T>()
    Component.GetComponentsInChildren(Type, bool)
    Component.GetComponentsInChildren(Type)
    Component.GetComponentsInChildren<T>(bool)
    Component.GetComponentsInChildren<T>(bool, List<T>)
    Component.GetComponentsInChildren<T>()
    Component.GetComponentsInChildren<T>(List<T>)
    Component.GetComponentInParent(Type, bool)
    Component.GetComponentInParent(Type)
    Component.GetComponentInParent<T>(bool)
    Component.GetComponentInParent<T>()
    Component.GetComponentsInParent(Type, bool)
    Component.GetComponentsInParent(Type)
    Component.GetComponentsInParent<T>(bool)
    Component.GetComponentsInParent<T>(bool, List<T>)
    Component.GetComponentsInParent<T>()
    Component.GetComponents(Type)
    Component.GetComponents(Type, List<Component>)
    Component.GetComponents<T>(List<T>)
    Component.GetComponents<T>()
    Component.GetComponentIndex()
    Component.CompareTag(string)
    Component.CompareTag(TagHandle)
    Component.SendMessageUpwards(string, object, SendMessageOptions)
    Component.SendMessageUpwards(string, object)
    Component.SendMessageUpwards(string)
    Component.SendMessageUpwards(string, SendMessageOptions)
    Component.SendMessage(string, object)
    Component.SendMessage(string)
    Component.SendMessage(string, object, SendMessageOptions)
    Component.SendMessage(string, SendMessageOptions)
    Component.BroadcastMessage(string, object, SendMessageOptions)
    Component.BroadcastMessage(string, object)
    Component.BroadcastMessage(string)
    Component.BroadcastMessage(string, SendMessageOptions)
    Component.transform
    Component.gameObject
    Component.tag
    Object.GetInstanceID()
    Object.GetHashCode()
    Object.Equals(object)
    Object.InstantiateAsync<T>(T)
    Object.InstantiateAsync<T>(T, Transform)
    Object.InstantiateAsync<T>(T, Vector3, Quaternion)
    Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)
    Object.InstantiateAsync<T>(T, int)
    Object.InstantiateAsync<T>(T, int, Transform)
    Object.InstantiateAsync<T>(T, int, Vector3, Quaternion)
    Object.InstantiateAsync<T>(T, int, ReadOnlySpan<Vector3>, ReadOnlySpan<Quaternion>)
    Object.InstantiateAsync<T>(T, int, Transform, Vector3, Quaternion)
    Object.InstantiateAsync<T>(T, int, Transform, Vector3, Quaternion, CancellationToken)
    Object.InstantiateAsync<T>(T, int, Transform, ReadOnlySpan<Vector3>, ReadOnlySpan<Quaternion>)
    Object.InstantiateAsync<T>(T, int, Transform, ReadOnlySpan<Vector3>, ReadOnlySpan<Quaternion>, CancellationToken)
    Object.InstantiateAsync<T>(T, InstantiateParameters, CancellationToken)
    Object.InstantiateAsync<T>(T, int, InstantiateParameters, CancellationToken)
    Object.InstantiateAsync<T>(T, Vector3, Quaternion, InstantiateParameters, CancellationToken)
    Object.InstantiateAsync<T>(T, int, Vector3, Quaternion, InstantiateParameters, CancellationToken)
    Object.InstantiateAsync<T>(T, int, ReadOnlySpan<Vector3>, ReadOnlySpan<Quaternion>, InstantiateParameters, CancellationToken)
    Object.Instantiate(Object, Vector3, Quaternion)
    Object.Instantiate(Object, Vector3, Quaternion, Transform)
    Object.Instantiate(Object)
    Object.Instantiate(Object, Scene)
    Object.Instantiate<T>(T, InstantiateParameters)
    Object.Instantiate<T>(T, Vector3, Quaternion, InstantiateParameters)
    Object.Instantiate(Object, Transform)
    Object.Instantiate(Object, Transform, bool)
    Object.Instantiate<T>(T)
    Object.Instantiate<T>(T, Vector3, Quaternion)
    Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
    Object.Instantiate<T>(T, Transform)
    Object.Instantiate<T>(T, Transform, bool)
    Object.Destroy(Object, float)
    Object.Destroy(Object)
    Object.DestroyImmediate(Object, bool)
    Object.DestroyImmediate(Object)
    Object.FindObjectsOfType(Type)
    Object.FindObjectsOfType(Type, bool)
    Object.FindObjectsByType(Type, FindObjectsSortMode)
    Object.FindObjectsByType(Type, FindObjectsInactive, FindObjectsSortMode)
    Object.DontDestroyOnLoad(Object)
    Object.DestroyObject(Object, float)
    Object.DestroyObject(Object)
    Object.FindSceneObjectsOfType(Type)
    Object.FindObjectsOfTypeIncludingAssets(Type)
    Object.FindObjectsOfType<T>()
    Object.FindObjectsByType<T>(FindObjectsSortMode)
    Object.FindObjectsOfType<T>(bool)
    Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)
    Object.FindObjectOfType<T>()
    Object.FindObjectOfType<T>(bool)
    Object.FindFirstObjectByType<T>()
    Object.FindAnyObjectByType<T>()
    Object.FindFirstObjectByType<T>(FindObjectsInactive)
    Object.FindAnyObjectByType<T>(FindObjectsInactive)
    Object.FindObjectsOfTypeAll(Type)
    Object.FindObjectOfType(Type)
    Object.FindFirstObjectByType(Type)
    Object.FindAnyObjectByType(Type)
    Object.FindObjectOfType(Type, bool)
    Object.FindFirstObjectByType(Type, FindObjectsInactive)
    Object.FindAnyObjectByType(Type, FindObjectsInactive)
    Object.ToString()
    Object.name
    Object.hideFlags
    object.Equals(object, object)
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: Fwt.Core.UI.Screens
    Assembly: fwt.core.dll
    Syntax
    public class UIManager : MonoBehaviour, IUISystemAPI

    Fields

    AllScreens

    List of all screens system knows about (created by the system or found in the scene).

    Declaration
    public List<UIScreen> AllScreens
    Field Value
    Type Description
    List<UIScreen>

    ScreenPrefabByName

    Dictionary of all prefabs of the UI Screens this system can create. Key - Screen name. This dictionary is filled when AddScreenPrefab() is called AddScreenPrefab(UIScreen). ApplyConfig(IList<UIScreen>)

    Declaration
    public Dictionary<string, UIScreen> ScreenPrefabByName
    Field Value
    Type Description
    Dictionary<string, UIScreen>

    ScreenPrefabByType

    Dictionary of all prefabs of the UI Screens this system can create. Key - Screen type. this dictionary is filled when AddScreenPrefab() is called AddScreenPrefab(UIScreen). ApplyConfig(IList<UIScreen>)

    Declaration
    public Dictionary<Type, UIScreen> ScreenPrefabByType
    Field Value
    Type Description
    Dictionary<Type, UIScreen>

    ScreenPrefabs

    List of all prefabs of the UI Screens this system can create. This list is filled when AddScreenPrefab() is called AddScreenPrefab(UIScreen). ApplyConfig(IList<UIScreen>)

    Declaration
    public List<UIScreen> ScreenPrefabs
    Field Value
    Type Description
    List<UIScreen>

    ScreensByName

    Dictionary of all screens system knows about (created by the system or found in the scene). Key - Screen name. CreateScreen(string)

    Declaration
    public Dictionary<string, UIScreen> ScreensByName
    Field Value
    Type Description
    Dictionary<string, UIScreen>

    ScreensByType

    Dictionary of all screens system knows about (created by the system or found in the scene). Key - Screen type. CreateScreen(Type)

    Declaration
    public Dictionary<Type, UIScreen> ScreensByType
    Field Value
    Type Description
    Dictionary<Type, UIScreen>

    isCollectUIScreensFromSceneOnStart

    If true, will collect all the UIScreens from the scene using Objecct.FindAllObjectsOfType in Start() method Start().

    Declaration
    [SerializeField]
    protected bool isCollectUIScreensFromSceneOnStart
    Field Value
    Type Description
    bool

    Properties

    IsCollectUIScreensFromSceneOnStart

    If true, OnCreate will collect all UIScreens from the scene using Objecct.FindAllObjectsOfType

    Declaration
    public bool IsCollectUIScreensFromSceneOnStart { get; set; }
    Property Value
    Type Description
    bool

    UIRoot

    Root object of the UI system. This object is created if none is found in the scene.

    Declaration
    public UIRoot UIRoot { get; }
    Property Value
    Type Description
    UIRoot

    UIScreenRoot

    Root transforms for place a UIScreen when it is created. The transform of the UIRoot UIRoot

    Declaration
    public Transform UIScreenRoot { get; }
    Property Value
    Type Description
    Transform

    Methods

    AddScreenPrefab(UIScreen)

    Declaration
    public virtual void AddScreenPrefab(UIScreen screenPrefab)
    Parameters
    Type Name Description
    UIScreen screenPrefab

    ApplyConfig(IList<UIScreen>)

    Copies the provided list of screen prefabs into the system, so it can use those prefabs to create screens on request.

    Declaration
    public virtual void ApplyConfig(IList<UIScreen> screenPrefabs)
    Parameters
    Type Name Description
    IList<UIScreen> screenPrefabs

    CollectChildScreens()

    Declaration
    [ContextMenu("Collect Child Screens")]
    protected virtual void CollectChildScreens()

    CollectUIScreensFromScene()

    Collects all UI screens present in the current scene and registers them for further processing.

    Declaration
    public virtual void CollectUIScreensFromScene()
    Remarks

    This method searches for all instances of UIScreen in the scene, including inactive ones, and registers each found screen. If no UI screens are found, the method exits without performing any actions.

    CreateScreen(UIScreen)

    Declaration
    public virtual UIScreen CreateScreen(UIScreen screenPrefab)
    Parameters
    Type Name Description
    UIScreen screenPrefab
    Returns
    Type Description
    UIScreen

    CreateScreen(string)

    Creates a new screen of the specified name. Takes a prefab in the ScreenPrefabByName dictionary ScreenPrefabByName

    Declaration
    public virtual UIScreen CreateScreen(string screenName)
    Parameters
    Type Name Description
    string screenName

    name of the UIScreen taken from UIScreen.Name when importing prefabsName

    Returns
    Type Description
    UIScreen

    created UIScreen instance

    CreateScreen(Type)

    Creates a new screen of the specified type. Takes a prefab in the ScreenPrefabByType dictionary ScreenPrefabByType

    Declaration
    public virtual UIScreen CreateScreen(Type screenType)
    Parameters
    Type Name Description
    Type screenType

    type of the screen to create (looks for prefab in ScreenPrefabByType dictionary)

    Returns
    Type Description
    UIScreen

    created UIScreen instance

    CreateScreen<TScreen>()

    Creates a new screen of the specified type.

    Declaration
    public virtual TScreen CreateScreen<TScreen>() where TScreen : UIScreen
    Returns
    Type Description
    TScreen

    screen instance

    Type Parameters
    Name Description
    TScreen

    type of the screen to create

    CreateScreen<TScreen>(string)

    Creates a new screen of the specified type.

    Declaration
    public virtual TScreen CreateScreen<TScreen>(string screenName) where TScreen : UIScreen
    Parameters
    Type Name Description
    string screenName
    Returns
    Type Description
    TScreen

    screen instance

    Type Parameters
    Name Description
    TScreen

    type of the screen to create

    DeleteAllScreenPrefabs()

    Declaration
    public virtual void DeleteAllScreenPrefabs()

    DeleteScreenPrefab(UIScreen)

    Declaration
    public virtual void DeleteScreenPrefab(UIScreen screenPrefab)
    Parameters
    Type Name Description
    UIScreen screenPrefab

    DeleteScreenPrefab(string)

    Declaration
    public virtual void DeleteScreenPrefab(string screenName)
    Parameters
    Type Name Description
    string screenName

    DeleteScreenPrefab<TScreen>()

    Declaration
    public virtual void DeleteScreenPrefab<TScreen>() where TScreen : UIScreen
    Type Parameters
    Name Description
    TScreen

    DestroyAllScreens()

    Destroys all UIScreen instances known by the system AllScreens.

    Declaration
    public virtual void DestroyAllScreens()

    DestroyScreen(UIScreen)

    Destroys the specified screen instance.

    Declaration
    public virtual bool DestroyScreen(UIScreen screen)
    Parameters
    Type Name Description
    UIScreen screen

    screen instance to destroy

    Returns
    Type Description
    bool

    true if the screen was destroyed successfully; otherwise, false

    DestroyScreen(string)

    Declaration
    public virtual void DestroyScreen(string screenName)
    Parameters
    Type Name Description
    string screenName

    DestroyScreen(Type)

    Declaration
    public virtual bool DestroyScreen(Type screenType)
    Parameters
    Type Name Description
    Type screenType
    Returns
    Type Description
    bool

    DestroyScreen<TScreen>()

    Destroys the specified screen.

    Declaration
    public virtual bool DestroyScreen<TScreen>() where TScreen : UIScreen
    Returns
    Type Description
    bool

    true if the screen was destroyed successfully; otherwise, false

    Type Parameters
    Name Description
    TScreen

    type of a screen to destroy

    FindObjectOnScene<TObject>(ref TObject, FindObjectsInactive)

    Finds the first active or inactive object of the specified type in the scene, or returns the provided reference if it is already assigned.

    Declaration
    public virtual TObject FindObjectOnScene<TObject>(ref TObject obj, FindObjectsInactive filter = FindObjectsInactive.Include) where TObject : MonoBehaviour
    Parameters
    Type Name Description
    TObject obj

    A reference to the object to find. If this reference is already assigned, it is returned without performing a search.

    FindObjectsInactive filter

    Specifies whether to include inactive objects in the search. The default is FindObjectsInactive.Include.

    Returns
    Type Description
    TObject

    The found object of type TObject, or null if no such object exists in the scene.

    Type Parameters
    Name Description
    TObject

    The type of MonoBehaviour to search for in the scene.

    Remarks

    This method uses Unity's FindFirstObjectByType to locate the object if the provided reference is null. If the object is not found, the reference remains null.

    GetOrCreateScreen(string)

    Declaration
    public virtual UIScreen GetOrCreateScreen(string screenName)
    Parameters
    Type Name Description
    string screenName
    Returns
    Type Description
    UIScreen

    GetOrCreateScreen(Type)

    Declaration
    public virtual UIScreen GetOrCreateScreen(Type screenType)
    Parameters
    Type Name Description
    Type screenType
    Returns
    Type Description
    UIScreen

    GetOrCreateScreen<TScreen>()

    Gets an existing screen of the specified type, or creates a new one if it doesn't exist.

    Declaration
    public virtual TScreen GetOrCreateScreen<TScreen>() where TScreen : UIScreen
    Returns
    Type Description
    TScreen

    screen instance

    Type Parameters
    Name Description
    TScreen

    type of the screen to get or create

    GetOrCreateScreen<TScreen>(string)

    Declaration
    public virtual TScreen GetOrCreateScreen<TScreen>(string screenName) where TScreen : UIScreen
    Parameters
    Type Name Description
    string screenName
    Returns
    Type Description
    TScreen
    Type Parameters
    Name Description
    TScreen

    GetScreen(string)

    Declaration
    public virtual UIScreen GetScreen(string screenName)
    Parameters
    Type Name Description
    string screenName
    Returns
    Type Description
    UIScreen

    GetScreen(Type)

    Declaration
    public virtual UIScreen GetScreen(Type screenType)
    Parameters
    Type Name Description
    Type screenType
    Returns
    Type Description
    UIScreen

    GetScreenPrefab(string)

    Declaration
    public virtual UIScreen GetScreenPrefab(string screenName)
    Parameters
    Type Name Description
    string screenName
    Returns
    Type Description
    UIScreen

    GetScreenPrefab(Type)

    Declaration
    public virtual UIScreen GetScreenPrefab(Type screenType)
    Parameters
    Type Name Description
    Type screenType
    Returns
    Type Description
    UIScreen

    GetScreenPrefab<TScreen>()

    Declaration
    public virtual TScreen GetScreenPrefab<TScreen>() where TScreen : UIScreen
    Returns
    Type Description
    TScreen
    Type Parameters
    Name Description
    TScreen

    GetScreenPrefab<TScreen>(string)

    Declaration
    public virtual TScreen GetScreenPrefab<TScreen>(string screenName) where TScreen : UIScreen
    Parameters
    Type Name Description
    string screenName
    Returns
    Type Description
    TScreen
    Type Parameters
    Name Description
    TScreen

    GetScreen<TScreen>()

    Gets an existing screen of the specified type if found.

    Declaration
    public virtual TScreen GetScreen<TScreen>() where TScreen : UIScreen
    Returns
    Type Description
    TScreen
    Type Parameters
    Name Description
    TScreen

    type of the screen to get

    GetUIRoot(ref UIRoot)

    Gets the existing UIRoot instance if provided; otherwise, creates and returns a new UIRoot component attached to a new GameObject.

    Declaration
    protected virtual UIRoot GetUIRoot(ref UIRoot uiRoot)
    Parameters
    Type Name Description
    UIRoot uiRoot

    A reference to a UIRoot instance. If this parameter is not null, the existing instance is returned; otherwise, a new instance is created.

    Returns
    Type Description
    UIRoot

    The UIRoot instance, either the provided one or a newly created instance if the provided reference is null.

    Remarks

    This method ensures that a UIRoot component is available for UI management. If a new UIRoot is created, it is attached to a GameObject named "UI Root".

    InitExistingScreens()

    Registers all existing user interface screens in the AllScreens collection for fast search.

    Declaration
    public virtual void InitExistingScreens()
    Remarks

    Call this method to ensure that all screens currently present in the collection are registered and available for interaction. This method does not create new screens; it only registers those that already exist in the collection. The collection of screens must not be null, and each screen should be valid for registration.

    IsCursorOverUI()

    Returns true if some UI element is under the cursor. Uses the

    Declaration
    public virtual bool IsCursorOverUI()
    Returns
    Type Description
    bool

    RegisterUIScreen(UIScreen)

    Registers a user interface screen with the system for management and retrieval.

    Declaration
    public virtual bool RegisterUIScreen(UIScreen screen)
    Parameters
    Type Name Description
    UIScreen screen

    The UIScreen instance to register. This parameter must not be null.

    Returns
    Type Description
    bool

    true if the screen was successfully registered; otherwise, false.

    Remarks

    If the screen has a non-empty Name property, it is indexed for quick retrieval by name. The screen is also indexed by its type. This method enables dynamic management of UI screens at runtime.

    Start()

    Declaration
    protected virtual void Start()

    Implements

    IUISystemAPI

    Extension Methods

    Extensions_UnityObject.SmartDestroy<TObject>(TObject)
    Extensions_UnityObject.SmartDisableGameObject<TObject>(TObject)
    Extensions_UnityObject.SmartEnableGameObject<TObject>(TObject)
    HashExtensions.GetHashCode_RefType<TValue>(TValue, int)
    Extensions_UnityObject.SmartDestroy(object)
    Extensions_UnityObject.SmartGetComponent<TComponent>(object)
    Extensions_UnityObject.SmartGetGameGameObject(object)
    In this article
    Back to top Generated by DocFX