摘要:
1,同一个脚本挂载在不同的对象上 1 public class Lesson1 : MonoBehaviour 2 { 3 // Start is called before the first frame update 4 5 6 //public GameObject Obj1; 7 publi 阅读全文
摘要:
1 void Start() 2 { 3 //获取当前对象 4 GameObject l1 = this.gameObject; 5 6 //获取指定对象 7 GameObject l2 = GameObject.Find("ls1"); 8 print(l1); 9 10 } 阅读全文
摘要:
1 void Start() 2 { 3 //所有对象挂载了相同的脚本 4 5 Lesson1 t1 = this.GetComponent("Lesson1") as Lesson1; 6 print(t1); 7 8 Lesson1 t2 = this.GetComponent(typeof(L 阅读全文
摘要:
1,获取当前挂载的对象名称 void Start() { //获取当前挂载的对象名称 print(gameObject.name); } 2,当前对象失活激活 void Start() { //当前对象失活 this.enabled = false; //当前对象激活 this.enabled = 阅读全文