Class UITKCharacterCreate
UI Toolkit implementation of the character creation control. Provides race/model/location selection and a name field, then broadcasts the creation request to the server.
public class UITKCharacterCreate : UITKControl
- Inheritance
-
ObjectComponentBehaviourMonoBehaviourUITKCharacterCreate
- 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
CharacterName
The name of the character being created.
public string CharacterName
Field Value
InitialModelNames
List of available model names for the dropdown.
public List<string> InitialModelNames
Field Value
InitialRaceNames
List of available race names for the dropdown.
public List<string> InitialRaceNames
Field Value
InitialSpawnLocationNames
List of available spawn location names for the dropdown.
public List<string> InitialSpawnLocationNames
Field Value
ModelIndex
The selected model index.
public int ModelIndex
Field Value
RaceIndex
The selected race index.
public int RaceIndex
Field Value
SelectedSpawnPosition
The selected spawn position index.
public int SelectedSpawnPosition
Field Value
WorldSceneDetailsCache
Cache containing details for world scenes and spawn positions.
public WorldSceneDetailsCache WorldSceneDetailsCache
Field Value
Properties
CanDrag
Full-screen forms are not windows: there is nowhere to drag them to.
protected override bool CanDrag { get; }
Property Value
Remarks
Methods
OnAfterShow()
Re-populates the dropdowns after the visual tree was rebuilt.
protected override void OnAfterShow()
Remarks
This is half of the fix for a character-create screen that was inert on the first
login. The scene sets StartOpen: 0, so the document is disabled and
TryStart defers OnStarting() to the visual-tree retry coroutine.
UIManager.SetClient then runs OnClientSet() — which is where the
population lived — while raceDropdown, modelDropdown and
locationDropdown were all still null, and every access was guarded by a null
check, so the whole thing silently did nothing. The player got three empty dropdowns and
a Create button that could never satisfy its own preconditions.
Both hooks are needed and neither is sufficient. OnAfterShow() alone misses
the very first open, because hasStarted is still false there and
ReinitializeIfTreeReplaced bails out; this one alone misses nothing structural
but is not called on an ordinary re-show. Population is idempotent and selection is
preserved by name, so running it from both costs a rebuild of three small lists.
Reordering the one call in UIManager.SetClient would also have made the symptom
go away, and would have left the panel just as dependent on the order two unrelated
systems happen to initialise in — which is what produced the bug's nastiest property:
quitting to login does SetClient(null) then SetClient(client), by which
time the tree exists, so it healed itself on the second login and presented as
intermittent.
OnAfterStarting()
Re-populates the dropdowns after the visual tree was rebuilt.
protected override void OnAfterStarting()
Remarks
This is half of the fix for a character-create screen that was inert on the first
login. The scene sets StartOpen: 0, so the document is disabled and
TryStart defers OnStarting() to the visual-tree retry coroutine.
UIManager.SetClient then runs OnClientSet() — which is where the
population lived — while raceDropdown, modelDropdown and
locationDropdown were all still null, and every access was guarded by a null
check, so the whole thing silently did nothing. The player got three empty dropdowns and
a Create button that could never satisfy its own preconditions.
Both hooks are needed and neither is sufficient. OnAfterShow() alone misses
the very first open, because hasStarted is still false there and
ReinitializeIfTreeReplaced bails out; this one alone misses nothing structural
but is not called on an ordinary re-show. Population is idempotent and selection is
preserved by name, so running it from both costs a rebuild of three small lists.
Reordering the one call in UIManager.SetClient would also have made the symptom
go away, and would have left the panel just as dependent on the order two unrelated
systems happen to initialise in — which is what produced the bug's nastiest property:
quitting to login does SetClient(null) then SetClient(client), by which
time the tree exists, so it healed itself on the second login and presented as
intermittent.
OnClick_Back()
Returns to the character list without tearing the session down. Bound to both the Back button and Escape.
public void OnClick_Back()
Remarks
Unlocking is not cosmetic here. Leaving while a creation was in flight left the reply guard armed, and the guard's expiry calls Show() on this panel — so half a minute after the player had moved on, the character-create form reappeared over the character list, the world list, or the game itself.
OnClick_CreateCharacter()
Validates input and broadcasts the character creation request.
public void OnClick_CreateCharacter()
OnClick_Quit()
Quits the client application.
public void OnClick_Quit()
OnClick_QuitToLogin()
Returns to the login screen.
public void OnClick_QuitToLogin()
OnClientSet()
Subscribes to events and populates the dropdowns when the client is injected.
public override void OnClientSet()
OnClientUnset()
Unsubscribes from events when the client is cleared.
public override void OnClientUnset()
OnModelDropdownValueChanged()
Updates the model index when the model selection changes.
public void OnModelDropdownValueChanged()
OnQuitToLogin()
Unlocks the create button when quitting to login.
public override void OnQuitToLogin()
OnRaceDropdownValueChanged()
Updates the race index and resets the model index when the race selection changes.
public void OnRaceDropdownValueChanged()
OnSpawnLocationDropdownValueChanged()
Updates the selected spawn position when the location selection changes.
public void OnSpawnLocationDropdownValueChanged()
OnStarting()
Resolves and caches visual elements and wires up callbacks.
public override void OnStarting()
OnTick()
Per-frame hook for controls that need one.
protected override void OnTick()