using System.Collections.Generic; using System.Text.RegularExpressions; using TMPro; using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.UI; /// /// UserCreationScreen scene manager /// public class UserCreationScreen : MonoBehaviour { /// /// Maximum lenght of a username /// private const int MAX_USERNAME_LENGTH = 12; /// /// Reference to the input text field for username /// public TMP_InputField inputName; /// /// Reference to the avatar-list container /// public Transform avatarsContainer; /// /// Avatar prefab /// public GameObject avatarPrefab; /// /// List of all sprites that are supported as avatars /// public List sprites = new List(); /// /// Reference to the UserList ScriptableObject /// public UserList users; /// /// Current selected avatar /// [SerializeField] private int selectedAvatar = 0; /// /// List of references to avatar background sprites (so we can color them nicely) /// private List avatars = new List(); /// /// Start is called before the first frame update /// void Start() { for (int i = 0; i < sprites.Count; i++) { // Create instance of prefab GameObject instance = GameObject.Instantiate(avatarPrefab, avatarsContainer); // Store value of i so we can use it the callback (else it would get the value of sprites.Count) int x = i; // Add onClick callback instance.GetComponent