Сейчас я просто тестирую префаб куба, но он не работает:
Код: Выделить всё
private void addAircraft(Plane plane)
{
listPlane.Add(plane);
//THIS 2 LINES ARE THE PROBLEM
GameObject cube = Instantiate(Resources.Load("Cube", typeof(GameObject))) as GameObject;
cube.transform.position = new Vector3((float)plane.X, 0, (float)plane.Y);
//
planeId_Object_Dictionnary.Add(plane.Flight, cube);
Debug.Log("Plane " + plane.Flight + " is added");
}
Код: Выделить всё
Load can only be called from the main thread.
Constructors and field initializers will be executed from the loading thread when loading a scene.
Don't use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function.
Подробнее здесь: https://stackoverflow.com/questions/365 ... with-unity