// Start is called before the first frame update
    void Start()
    {
        var slots = SaveLoadSystem.GetAllSlots();

        if (slotStateTexts.Length != slots.Length || slotStateTexts2.Length != slots.Length)
        {
            Debug.LogError("The number of slot state texts does not correspont to the number of slots in the game.");
            Destroy(this);
        }

        if (loadButtons.Length != slots.Length)
        {
            Debug.LogError("The number of load buttons does not correspont to the number of slots in the game.");
            Destroy(this);
        }

        if (startButtons.Length != slots.Length)
        {
            Debug.LogError("The number of load buttons does not correspont to the number of slots in the game.");
            Destroy(this);
        }

        for (int j = 0; j < slots.Length; j++)
        {
            var text = slots[j]?.playerName ?? emptyText;
            slotStateTexts[j].text  = text;
            slotStateTexts2[j].text = text;
        }

        SetLoadGameButton();
        SetNewGameButton();
        SetSelectSlotButton();
        SetStartButton();
        SetLoadButton();
        LimitCharacterName();
    }