# How CharacterSelector works

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.

<figure><img src="/files/5w2CiFcuNorNXH3j5lJy" alt=""><figcaption></figcaption></figure>

It contains the ElementsConfigurator script.

<figure><img src="/files/Hm05sheLi0DmSRYm9WUm" alt=""><figcaption></figcaption></figure>

Inside the canvas panel, it also contains the CharacterSelectionScreen GameObject.

<figure><img src="/files/RyErCRcrQJWZJSoVuNxv" alt=""><figcaption></figcaption></figure>

Which contains the UISelectorPanel script.

<figure><img src="/files/xnOXVrVGgp9Hsbi6DMa5" alt=""><figcaption></figcaption></figure>

Let's explain each script.

### ElementsConfigurator

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.

### UISelectorPanel

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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.nice1.dev/nice1-plugin/unity/how-characterselector-works.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
