[SerializeField] private Transform trans; 这样可以在Inspector视图中对 私有变量 达到公共变量的效果,直接赋值。 参考资料 1. Unity常用[xxx]用法 特性 2. 3. 4.