Class UITKLoadingScreen
UI Toolkit implementation of the loading screen. Displays a transition image and a progress bar driven by addressable load progress and FishNet scene load events.
public class UITKLoadingScreen : UITKControl
- Inheritance
-
ObjectComponentBehaviourMonoBehaviourUITKLoadingScreen
- Inherited Members
-
MonoBehaviour.IsInvoking()MonoBehaviour.CancelInvoke()MonoBehaviour.StopCoroutine(Coroutine)MonoBehaviour.StopAllCoroutines()MonoBehaviour.destroyCancellationTokenMonoBehaviour.useGUILayoutMonoBehaviour.didStartMonoBehaviour.didAwakeMonoBehaviour.runInEditModeBehaviour.enabledBehaviour.isActiveAndEnabledComponent.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.transformComponent.transformHandleComponent.gameObjectComponent.tagObject.GetEntityId()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.FindObjectsByType<T>()Object.FindObjectsByType<T>(FindObjectsInactive)Object.ToString()Object.nameObject.hideFlags
Fields
DefaultLoadingScreenSprite
The default sprite to use for the loading screen.
public Sprite DefaultLoadingScreenSprite
Field Value
- Sprite
Details
Cache containing details for world scenes, including transition images.
public WorldSceneDetailsCache Details
Field Value
Properties
Layer
Draw order tier for this panel. See UITKPanelLayer.
protected override UITKPanelLayer Layer { get; }
Property Value
Methods
Client_OnEnterGameWorld()
Holds the overlay up for the whole of world entry.
public void Client_OnEnterGameWorld()
Remarks
See FishMMO.Client.UITKLoadingScreen.worldEntryActive.
Client_OnReconnectAttempt(int, int)
Resets the loading image and shows the screen on a reconnect attempt.
public void Client_OnReconnectAttempt(int attempts, int maxAttempts)
Parameters
Client_OnReconnectFailed()
Hides the loading screen on reconnect failure.
public void Client_OnReconnectFailed()
Client_OnReconnectPending()
Raises the overlay as soon as a reconnect is armed, before its delay elapses.
public void Client_OnReconnectPending()
Remarks
See FishMMO.Client.UITKLoadingScreen.reconnectPendingActive.
Hide(bool)
Hides the loading screen and clears the driver flags.
public override void Hide(bool overrideIsAlwaysOpen)
Parameters
overrideIsAlwaysOpenboolWhen true, the call is a no-op.
Remarks
Clearing here keeps the flags honest when something outside this class hides the
overlay (Client.DismissLoadingScreen does, on local character start).
Stale flags would otherwise let the next refresh pop the overlay back up over
live gameplay.
This must override Hide(bool), not Hide(). Hide() is
Hide(IsAlwaysOpen), and the quit-to-login teardown calls Hide(false)
directly — so with the clearing on the parameterless overload the teardown took the
panel down without clearing a single driver, and OnQuitToLogin() then
re-ran RefreshVisibility(bool), saw FishMMO.Client.UITKLoadingScreen.worldEntryActive still set
from the session that had just ended, and put the overlay straight back up. The result
was a full-screen loading overlay covering the login screen with no driver left that
could ever take it down and, before the escape hatch below, no button on it: quitting
to login from the world was itself a route to the unrecoverable empty screen.
OnAfterShow()
Called at the end of Show(), against the tree the player will actually see. Override to write content that changes from one opening to the next.
protected override void OnAfterShow()
Remarks
This exists because "set the text, then Show" does not work and fails silently. UnityEngine.UIElements.UIDocument clones the UXML on enable, so a panel that fills in its message, list rows or icon before calling Show() writes into a tree that is thrown away microseconds later, and the player sees whatever the UXML declares — an empty dialog, a blank tooltip, a selector with no rows.
Distinct from OnAfterStarting(), which re-applies state after the tree is rebuilt. This one runs on every show, rebuilt tree or not.
OnAfterStarting()
Re-applies the escape hatch after the visual tree was rebuilt.
protected override void OnAfterStarting()
Remarks
The overlay can be re-shown while the hatch is already offered — a reconnect attempt lands on an overlay that has been up for a minute — and the rebuilt tree carries the UXML's collapsed default, so without this the only control on the screen would silently disappear at the worst possible moment.
OnClick_ReturnToLogin()
Abandons whatever the overlay was waiting for and returns the player to the login screen.
public void OnClick_ReturnToLogin()
Remarks
QuitToLogin rather than a bare Hide(bool). Hiding alone would
reveal whichever panel happened to be underneath — which, on every path that reaches
this button, is none: the login panel has hidden itself, character select hides on
Stopped, and the world is either half-built or gone. The teardown is what puts a panel
back and it is the route every login panel already implements.
OnClientSet()
Subscribes to scene and reconnect events when the client is injected.
public override void OnClientSet()
OnClientUnset()
Unsubscribes from scene and reconnect events when the client is cleared.
public override void OnClientUnset()
OnDestroying()
Unsubscribes from addressable progress updates when the control is destroyed.
public override void OnDestroying()
OnProgressUpdate(float)
Updates the loading progress bar and tracks whether an Addressable load is running.
public void OnProgressUpdate(float progress)
Parameters
progressfloatThe current loading progress (0-1).
Remarks
OnProgressUpdate is a global aggregate: it reports on every load in flight, not just the one this screen cares about. That is exactly what an overall loading bar wants, but it means completion here says "the queue is empty", not "the transition is done" — hence the driver flags.
OnQuitToLogin()
Re-asserts the overlay's own state after the quit-to-login teardown.
public override void OnQuitToLogin()
Remarks
The base handler forces visibility straight from CloseOnQuitToMenu, and it does
so through a path that bypasses this control's Show()/Hide(bool)
overrides — so the driver flags are left exactly as they were while the panel is
switched underneath them. Either half of that mismatch is a visible fault: flags left
set behind a hidden panel pop the overlay back up on the next progress tick, and a
panel forced visible with no driver set has nothing that will ever take it down.
Re-running the normal decision leaves the two in agreement whichever way the flag is
configured.
OnStarting()
Resolves cached elements, subscribes to addressable progress updates, and seeds visibility from the processor's live state.
public override void OnStarting()
Remarks
The seed matters whenever this control lives in a scene the processor is itself
loading: every OnProgressUpdate raised
before this Awake is lost, so the earliest tick it can observe arrives only once
some later chained item finishes — leaving boot uncovered. Reading
IsLoading starts it from the truth instead.
Note this only holds when StartOpen is true, since
FishMMO.Client.UITKControl.Awake() hides the control after this method returns
otherwise.
OnTick()
Offers the escape hatch once the overlay has outlasted any honest transition, and keeps the deferred login notices moving.
protected override void OnTick()
Remarks
This is the invariant this panel is responsible for: the loading overlay covers every other panel in the client, including the modals, so for as long as it is up it is the UI. Four independent drivers raise it and two of them — FishMMO.Client.UITKLoadingScreen.worldEntryActive and FishMMO.Client.UITKLoadingScreen.reconnectPendingActive — are cleared only by Hide(bool), so anything that leaves one set holds the screen with nothing on it to press. Rather than enumerate the ways that can happen, the overlay gives itself a deadline and then offers a way out.
Show()
Shows the loading screen and resets the progress bar.
public override void Show()