how to mak an array in unity code example
Example 1: unity array c#
string[ ] familyMembers = new string[]{"John", "Amanda", "Chris", "Amber"} ;
string[ ] carsInTheGarage = new string[] {"VWPassat", "BMW"} ;
int[ ] doorNumbersOnMyStreet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 };
GameObject[ ] carsInTheScene = GameObject.FindGameObjectsWithTag("car");
Example 2: unity functinos in array
delegate void FuncsMethod();
void CreateList()
{
List<FuncsMethod> funcs = new List<FuncsMethod>();
funcs.Add(function1);
funcs.Add(function2);
funcs[0]();
}
void function1()
{
Debug.Log("Function 1 called.");
}
void function2()
{
Debug.Log("Function 2 called.");
}
Example 3: unity array c#
GameObject[ ] carsInTheScene = GameObject.FindGameObjectsWithTag("car");