I want a parent class to contain a static LinkedList with all Instances of the class so I can manipulate or search them all at once.
Unfortunately I do not understand Unity enough yet to get this to work.
This is an example of what I am trying to do.
I tried using gameObject instead of Character and even GetComponent() returns a nullpointer exception.
public abstract class Character : MonoBehaviour {
public static LinkedList<Character> characters;
void Start () {
ChildStart();
RegisterCharacter(this as Character);
}
public static void RegisterCharacter(Character c)
{
characters.AddLast(c);
Debug.Log("Registred " + c.name);
}
}
Can anyone help me please? Thank you