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
Component
Behaviour
MonoBehaviour
UIManager
Inherited Members
MonoBehaviour.IsInvoking()
MonoBehaviour.CancelInvoke()
MonoBehaviour.StopCoroutine(Coroutine)
MonoBehaviour.StopAllCoroutines()
MonoBehaviour.destroyCancellationToken
MonoBehaviour.useGUILayout
MonoBehaviour.didStart
MonoBehaviour.didAwake
MonoBehaviour.runInEditMode
Behaviour.enabled
Behaviour.isActiveAndEnabled
Component.GetComponent<T>()
Component.TryGetComponent<T>(out T)
Component.GetComponentInChildren<T>()
Component.GetComponentsInChildren<T>()
Component.GetComponentInParent<T>()
Component.GetComponentsInParent<T>()
Component.GetComponents<T>()
Component.GetComponentIndex()
Component.CompareTag(TagHandle)
Component.transform
Component.gameObject
Component.tag
Object.GetInstanceID()
Object.GetHashCode()
Object.InstantiateAsync<T>(T)
Object.InstantiateAsync<T>(T, Transform)
Object.InstantiateAsync<T>(T, Vector3, Quaternion)
Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)
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<T>(T)
Object.Instantiate<T>(T, Vector3, Quaternion)
Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
Object.Instantiate<T>(T, Transform)
Object.Destroy(Object)
Object.DestroyImmediate(Object)
Object.DontDestroyOnLoad(Object)
Object.DestroyObject(Object)
Object.FindObjectsOfType<T>()
Object.FindObjectsByType<T>(FindObjectsSortMode)
Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)
Object.FindObjectOfType<T>()
Object.FindFirstObjectByType<T>()
Object.FindAnyObjectByType<T>()
Object.FindFirstObjectByType<T>(FindObjectsInactive)
Object.FindAnyObjectByType<T>(FindObjectsInactive)
Object.ToString()
Object.name
Object.hideFlags
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
ScreenPrefabByName
Declaration
public Dictionary<string, UIScreen> ScreenPrefabByName
Field Value
ScreenPrefabByType
Declaration
public Dictionary<Type, UIScreen> ScreenPrefabByType
Field Value
ScreenPrefabs
Declaration
public List<UIScreen> ScreenPrefabs
Field Value
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
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
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
Properties
IsCollectUIScreensFromSceneOnStart
If true, OnCreate will collect all UIScreens from the scene using Objecct.FindAllObjectsOfType
Declaration
public bool IsCollectUIScreensFromSceneOnStart { get; set; }
Property Value
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
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
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()
CreateScreen(UIScreen)
Declaration
public virtual UIScreen CreateScreen(UIScreen screenPrefab)
Parameters
| Type |
Name |
Description |
| UIScreen |
screenPrefab |
|
Returns
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
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
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.
|
GetOrCreateScreen(string)
Declaration
public virtual UIScreen GetOrCreateScreen(string screenName)
Parameters
| Type |
Name |
Description |
| string |
screenName |
|
Returns
GetOrCreateScreen(Type)
Declaration
public virtual UIScreen GetOrCreateScreen(Type screenType)
Parameters
| Type |
Name |
Description |
| Type |
screenType |
|
Returns
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 Parameters
GetScreen(string)
Declaration
public virtual UIScreen GetScreen(string screenName)
Parameters
| Type |
Name |
Description |
| string |
screenName |
|
Returns
GetScreen(Type)
Declaration
public virtual UIScreen GetScreen(Type screenType)
Parameters
| Type |
Name |
Description |
| Type |
screenType |
|
Returns
GetScreenPrefab(string)
Declaration
public virtual UIScreen GetScreenPrefab(string screenName)
Parameters
| Type |
Name |
Description |
| string |
screenName |
|
Returns
GetScreenPrefab(Type)
Declaration
public virtual UIScreen GetScreenPrefab(Type screenType)
Parameters
| Type |
Name |
Description |
| Type |
screenType |
|
Returns
GetScreenPrefab<TScreen>()
Declaration
public virtual TScreen GetScreenPrefab<TScreen>() where TScreen : UIScreen
Returns
Type Parameters
GetScreenPrefab<TScreen>(string)
Declaration
public virtual TScreen GetScreenPrefab<TScreen>(string screenName) where TScreen : UIScreen
Parameters
| Type |
Name |
Description |
| string |
screenName |
|
Returns
Type Parameters
GetScreen<TScreen>()
Gets an existing screen of the specified type if found.
Declaration
public virtual TScreen GetScreen<TScreen>() where TScreen : UIScreen
Returns
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.
|
InitExistingScreens()
Registers all existing user interface screens in the AllScreens collection for fast search.
Declaration
public virtual void InitExistingScreens()
IsCursorOverUI()
Returns true if some UI element is under the cursor.
Uses the
Declaration
public virtual bool IsCursorOverUI()
Returns
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.
|
Start()
Declaration
protected virtual void Start()
Implements
Extension Methods