I got these bad guys
My code seems to be all good, and I even tried copying and pasting from the github project but still got the same problem.
Here my looks inside my Unity
Here my code (ignore the comments u.u)
using UnityEngine;
using UnityEngine.UI;
public class AdventureGame : MonoBehaviour
{
[SerializeField] Text textComponent;
[SerializeField] State startingState; //Now we need a way to continuely now what State we are in.
State state; //Aqui solo tenemos una variable de tipo State, tiene acceso a las funciones de esa clase.
// [SerializeField] State startingState; crea un espacio que se puede observar en el scrip en el inspector
//aunque al pasar allá queda Unite lo organiza asà Starting State :____________ luego en ese espacio en blanco
//se asigna el scrip del que hereda las funciones.
void Start()
{
state = startingState; //aqui definimos state para que haga referencia a los datos que contiene startingState
//startingState Contiene la historia.
textComponent.text = state.GetStateStory();
}
// Update is called once per frame
void Update()
{
ManageState();
}
private void ManageState()
{
var nextStates = state.GetNextState();
if (Input.GetKeyDown(KeyCode.Alpha1))
{
state = nextStates[0];
}
else if (Input.GetKeyDown(KeyCode.Alpha2))
{
state = nextStates[1];
}
else if (Input.GetKeyDown(KeyCode.Alpha3))
{
state = nextStates[2];
}
textComponent.text = state.GetStateStory();
}
}
using UnityEngine;
[CreateAssetMenu(menuName = "State")]
public class State : ScriptableObject
{
[TextArea(10, 14)] [SerializeField] string storyText;
[SerializeField] State[] nextStates;
public string GetStateStory()
{
return storyText;
}
public State[] GetNextState()
{
return nextStates;
}
}
Hope it’s not a problem with unity a few days ago it was arguing that he was read-only, but then give it administrator powers to both the hub and the black unity icon, and then it was just fine.
Help me pls I’m dying here