using System.Collections.Generic; using System.Text.RegularExpressions; using TMPro; using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.UI; public class UserCreationScreen : MonoBehaviour { // Max length of a username private const int MAX_USERNAME_LENGTH = 12; [Header("UI References")] // Reference to the input text field for username public TMP_InputField inputName; // Reference to the avatar-list container public Transform avatarsContainer; [Header("Prefab")] // Avatar prefab public GameObject avatarPrefab; // List of all sprites that are supported as avatars public List sprites = new List(); [Header("Users List")] // Reference to the UserList ScriptableObject public UserList users; [SerializeField] // Current selected avatar private int selectedAvatar = 0; // List of references to avatar background sprites (so we can color them nicely) private List avatars = new List(); 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