So I’ve been trying to get this code to output the count of a list in a derived count but for some reason it always says the count is 0. I’m not entirely sure what I’m doing wrong. Is it jsut not possible? Help!
public class ShipBehavior : MonoBehaviour
{
public List<Vector3> position = new List<Vector3>();
protected void Start ()
{
SetPoints();
}
protected void SetPoints ()
{
position.Add(new Vector3(-2f, -0.9f, -4.5f));
position.Add(new Vector3(0f, -1.2f, -4.5f));
position.Add(new Vector3(2f, -0.9f, -4.5f));
}
}
public class BarrelParent : ShipBehavior
{
void Start ()
{
InvokeRepeating("Spawn", 2, 1.0f);
}
void Spawn ()
{
//outputs as 0
Debug.Log(position.Count.ToString());
}
}