Hello! I’m new here! Can someone help me! I’m stuck whit a problem!!!
error CS 1061
Assets\Scripts\AdventureGame.cs(33,48): error CS1061: ‘State’ does not contain a definition for ‘Lenght’ and no accessible extension method ‘Lenght’ accepting a first argument of type ‘State’ could be found (are you missing a using directive or an assembly reference?)
Here is my code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class AdventureGame : MonoBehaviour {
[SerializeField] Text textComponent;
[SerializeField] State startingState;
State 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()
{
ManageState();
}
private void ManageState()
{
var nextStates = state.GetNextStates();
for (int index = 0; index < nextStates.Lenght; index++)
{
if(Input.GetKeyDown(KeyCode.Alpha1 + index))
{
state = nextStates[index];
}
}
textComponent.text = state.GetStateStory();
}
}