How can I create/store and access information about my workers from my base class “WorkerClass”?
public class WorkerClass : MonoBehaviour
{
public string name;
public int age;
public float spawnTime;
}
public class createNewWorker : WorkerClass
{
WorkerClass newWorker = new WorkerClass();
newWorker.name = ListOfWorkersNames[Random.Range[0,ListOfWorkersNames.Count];
newWorker.age = Random.Range(18,65);
newWorker.spawnTime = Random.Range(0,600);
}
This just sets up information about one newWorker... but I need many of them!
So I need to store the created information then loop it so it creates another worker and so on.
Can I make a different name for every new class created?
And how can I access them?
say I got 35 workers how can I find the name of worker number 21?