1,同一个脚本挂载在不同的对象上
1 public class Lesson1 : MonoBehaviour 2 { 3 // Start is called before the first frame update 4 5 6 //public GameObject Obj1; 7 public Lesson1 ls1; 8 9 void Start() 10 { 11 12 print(ls1.gameObject.name); 13 14 } 15 16 // Update is called once per frame 17 void Update() 18 { 19 20 } 21 }