Oddly enough, I cant seem to call list.Count on “Waypoints” out side of the class??
Debug.Log (WaypointManager.Waypoints[0].name);
will return just fine on the PlayerScript class… but WaypointManager.Waypoints.count always returns 0 from the player script class
public class WaypointManager: MonoBehaviour {
public List<GameObject> Waypoints{get;set;}
void Start()
{
if(Waypoints == null){
Waypoints = new List<GameObject>();
}
}
...
}
public class PlayerScript : MonoBehaviour {
public WaypointManager WaypointManager{get;set;}
void Start () {
WaypointManager = GameObject.Find(this.transform.parent.name + "/WaypointManager").GetComponent<WaypointManager>();
}
public void Getcount(){
WaypointManager.Waypoints.count//Will always return 0
WaypointManager.Waypoints[0].name//Will return just fine
}