When im trying to go to the next state i keep getting the error message that the array is out of bounds, even though the array is 0 - 1
here is my code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class AdventureGame : MonoBehaviour
{
[SerializeField] Text textComponent;
[SerializeField] States startingState;
States state;
// Start is called before the first frame update
void Start()
{
state = startingState;
textComponent.text = state.getStateStory();
}
// Update is called once per frame
void Update()
{
MangageState();
}
private void MangageState()
{
States[] nextUp = state.getNextStates();
if(Input.GetKeyDown(KeyCode.Alpha1))
{
state = nextUp[0];
}
}
}
any ideas for what im supposed to do and yes im pressing down ON the button but even if i do it brings up this error…