I’m trying to store the scripts from several different instances of the base class “AeroplaneControls” within an array. So that I can later use this array to quicker access all the different methods contained in the subclasses. However when I do this I get the following error “Object reference not set to an instance of an object”
GameObject[] Vehicles;
AeroplaneControls[] Controls;
Vehicles = GameObject.FindGameObjectsWithTag ("Vehicle");
Controls = new AeroplaneControls[Vehicles.Length];
for(int i = 0; i < Vehicles.Length; i++){
Controls _= Vehicles*.GetComponent<AeroplaneControls> ();*_
}
It is not refeering to my gameObject “Vehicles” since I can do other stuff with it like find it’s position, so the problem is with my “AeroplaneControls” script array.