Головна‎ > ‎Unity‎ > ‎

Створити об'єкт

//1

public GameObject Obj;

Instantiate(Obj);  


//2

Instantiate(Obj, new Vector3(5, 4, 3);


//3

Instantiate(ObjObj.transform.position, Quaternion.identity);


//4

Instantiate(ObjObj.transform.position, Obj.transform.rotation);


//5 створюємо об'єкт go як GameObject (а не Rigitbody...)

GameObject go = Instantiate(Obj, transform.position, transform.rotation) as GameObject;
go.GetComponent<Rigidbody>().AddForce(transform.up * 2500);