複製1
public void Duplicate(){
GameObject orgObj = GameObject.CreatePrimitive (PrimitiveType.Capsule);
for (int i = 0; i < 50; i++) {
float x = Random.Range(-3, 3);
float y = Random.Range(-3, 3);
float z = Random.Range(-3, 3);
int rotX = Random.Range(0, 360);
int rotY = Random.Range(0, 360);
int rotZ = Random.Range(0, 360);
Object.Instantiate(orgObj, new Vector3(x, y, z), Quaternion.Euler(rotX, rotY, rotZ));
}
}
複製2
これはまだ編集中
public GameObject[] RockPre;
float time;
void Start () {
}
void Update () {
time+=Time.deltaTime;
if (time >= 2){
int RockIndex=Random.Range(0,2);
float Rock_X=Random.Range(1,8);
Instantiate(RockPre[RockIndex],new Vector3(Rock_X,0,0),transform.rotation);
time=0;
}
}