GameObject arr ={point0, point1,point2, point3,point4,point5,point6,point7,point8,point9,point10,point11,};
public GameObject point0;
public GameObject point1;
public GameObject point2;
public GameObject point3;
public GameObject point4;
public GameObject point5;
public GameObject point6;
public GameObject point7;
public GameObject point8;
public GameObject point9;
public GameObject point10;
public GameObject point11;
The error you were probably getting was CS0236. That says that you cannot initialise your array outside of a method. You don’t show where your code sits in respect of the entire module but the following should work OK:
public class Test : MonoBehaviour
{
public GameObject point0;
public GameObject point1;
public GameObject point2;
public GameObject point3;
public GameObject point4;
public GameObject point5;
public GameObject point6;
public GameObject point7;
public GameObject point8;
public GameObject point9;
public GameObject point10;
public GameObject point11;
GameObject[] arr;
void Start()
{
arr = new GameObject[]
{
point0, point1, point2, point3,
point4, point5, point6, point7,
point8, point9, point10, point11
};
}
}
Thank you. I already fixed everything.