unity gameObject/GameObject transform/Transform 的区别

您所在的位置:网站首页 transform组件包含物体的什么信息 unity gameObject/GameObject transform/Transform 的区别

unity gameObject/GameObject transform/Transform 的区别

#unity gameObject/GameObject transform/Transform 的区别| 来源: 网络整理| 查看: 265

GameObject和Transform都是类,而gameObject和transform都是当前物体下这两个类的对象。

在使用当前游戏物体时,可以直接用gameObject,而调用其他物体需要先声明public GameObject xxx;

在使用Transform类下的函数,比如改变position,如果是改变本物体,则

this.transform.position=new Vector3(0, 0, 0);

而如果是改变其他物体的位置,则需要

xxx.GetComponent().position=new Vector3(0, 0, 0);



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3