Hello, as mentioned in the title, I am experiencing some issues with the coding written during lesson 27. I have just installed Visual Studio 2019, and I have tried to follow exactly the instructions, but it shows two error codes. On VS it mentions CS0149 and it says “method name expected”, on Unity instead it says “error cs0119: expression denotes a variable where a method group was expected”.
Here are the screens
here is the code for the two scripts, may I ask you what am I doing wrong?
ADVENTURE GAME SCRIPT
public class AdventureGame : MonoBehaviour {
[SerializeField] Text textComponent;
[SerializeField] State startingState;
string[] daysoftheweek = { "monday", "tuesday", "wednesday", "thursday", "saturday" };
State state;
// Use this for initialization
void Start () {
state = startingState;
textComponent.text = state.GetStateStory();
Debug.Log(daysoftheweek[3]);
}
// Update is called once per frame
void Update () {
ManageState();
}
private void ManageState()
{
var nextStates = state.GetNextStates();
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();
}
}
STATE SCRIPT
[CreateAssetMenu(menuName = “State”)]
public class State : ScriptableObject {
[TextArea(14, 10)] [SerializeField] string storyText;
[SerializeField] State[] nextStates;
public string GetStateStory()
{
return storyText;
}
public State[] GetNextStates()
{
return nextStates;
}
}
I apologize for the confusion and thank you in advance!!
Kind Regards,
Giuseppe