using System.Collections; using System.Collections.Generic; using UnityEngine; public class sh : MonoBehaviour { public GameObject cube1; public GameObject cube2; public GameObject cube3; // Use this for initialization void Start () { Debug.Log ("hello world"); //第一种拖过来,第二种程序绑定 cube1 = GameObject.Find("Cube1"); cube2 = GameObject.Find("Cube2"); cube3 = GameObject.Find("Cube3"); } // Update is called once per frame void Update () { //旋转 //this.transform.Rotate (Vector3.up*1,Space.Self); //this.transform.Translate (-Vector3.left * 0.2f, Space.World); /*this.transform.localScale = new Vector3(1, 1 + Mathf.Sin(Time.time), 1 + Mathf.Sin(Time.time)); */ cube1.transform.Translate(Vector3.up*0.1f, Space.World); cube2.transform.Rotate(Vector3.up*1,Space.Self); cube3.transform.localScale = new Vector3(1 + Mathf.Sin(Time.time), 1 + Mathf.Sin(Time.time), 1 + Mathf.Sin(Time.time)); } }