Unity3d--随机数Random.rotation 物体会随机的自身旋转。
1 using UnityEngine; 2 using System.Collections; 3 4 public class Test : MonoBehaviour { 5 6 private Quaternion[] quaters; 7 8 void Awake(){ 9 quaters = new Quaternion[7]; 10 } 11 12 void Start () { 13 int i = 0; 14 while (i<quaters.Length) { 15 quaters [i] = Random.rotation; 16 Transform child = this.transform.GetChild (i); 17 child.rotation = quaters [i]; 18 i++; 19 } 20 } 21 }