How CharacterSelector works
Last updated
Last updated
The demo scene is similar to the login one, but with some additions.
In the scene, we have replaced the WalletManager GameObject with the CharacterSelector, which holds the WalletManager as a child.
It contains the ElementsConfigurator script.
Inside the canvas panel, it also contains the CharacterSelectionScreen GameObject.
Which contains the UISelectorPanel script.
Let's explain each script.
It has the information of the components which will appear on the panel. Its sections are as follows:
Data & elements: It contains information regarding the data to be displayed on the screen, as well as a reference to a ScriptableObject from which to load or to which to save the defined data, and the necessary WalletManager to establish a connection with the server.
Settings: Within it, the display mode is defined, an owner is set for testing from the inspector without the need to run the scene or perform a login; the UI element where the buttons will be created is specified, along with the prefab of the button to be created for each data (the Character prefab is used).
Some buttons:
Load data from scriptable data list: Load the data from the ScriptableDataList into the list of elements that we need to define.
Save data into scriptable data list: Save the defined data in the list of elements within the ScriptableDataList.
Create elements in the UI: Remove the elements within the Target component to create a set of prefabs in it using the data entered in the list of elements. Note: Once created, these elements should be arranged in the panel.
Refresh licenses: Verify the licenses to check them and show or hide each button based on whether their corresponding license is owned or not.
It contains the following references:
Configurator: The ElementsConfigurator script of the scene.
User Panel: The panel which will be displayed in case a license is not available.
Text User Account: Text with the username if the license is available or with the text "No license" if the license is not available.