I’m trying to work on a getting my AI to Follow procedurally generated waypoints. When I try to do this however my list is empty despite using the same syntax I had used for other list storage which worked just fine. here are examples from my code
public class GameData : MonoBehaviour {
public List<GameObject> players;
public List<GameObject> waypoints
}
public class InputController : MonoBehaviour {
private void Awake()
{
//works
Singleton.gm.GetComponent<GameData>().players.Add(gameObject);
}
public class Register_Waypoints : MonoBehaviour {
// Use this for initialization
void Awake () {
//does not work
Singleton.gm.GetComponent<GameData>().waypoints.Add(gameObject);
}
}
I have essentially the same thing scripted for the possible spawn points for both my player and my AI as well as the AI itself registers inside a list in the game data script and those all work just fine but for some reason the waypoints don’t show up. Why is this happening.