untiy中操作obj
阿新 • • 發佈:2018-03-31
debug initial called call span col sca generic tar
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)); } }
untiy中操作obj