- 博客(2)
- 收藏
- 关注
转载 RectTransform
1.改变RectTransform的topGetComponent<RectTransform>().offsetMax = new Vector2(GetComponent<RectTransform>().offsetMax.x, top);2.改变RectTransform的bottomGetComponent<RectTransform>().offse...
2018-06-08 21:41:26
212
转载 Unity3D开发中继承了MonoBehaviour的类,不要再构造函数初始化。
MonoBehaviour派生出来的类会作为Unity3D中的Component挂载在GameObject上,而GameObject会在编辑器的多个地方被显示,如场景编辑器内、Prefab选中时等,这些时候都需要调用它们的构造函数来初始化成员变量的默认值,以便在编辑器中显示它们。也就是说,构造函数不光在游戏运行时会被调用,它的调用时机是“未知的”。而Awake和Start只会在游戏运行时被调用,并...
2018-05-19 16:13:30
2813
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人