unity 脚本中如何获得另外物体的数据

 时间:2024-10-13 01:24:17

1、打开unity3d选择菜单中的“GameObject”--“3D Object”。

unity 脚本中如何获得另外物体的数据

3、接着我们创建两个脚本,一个Cube_data、一个Sphere_data。

unity 脚本中如何获得另外物体的数据unity 脚本中如何获得另外物体的数据

6、在Cube_data脚本的start中通过GameObject.Find获得并输出烂瘀佐栾这个sphere_aa变量的数值(同样方式我们也可以获得其它组件属性)。void Start () { int aa =GameObject.Find("Sphere").GetComponent<Sphere_data>().sphere_aa; print(""+aa); }

unity 脚本中如何获得另外物体的数据
  • unity怎么打开资源商店
  • Unity怎么导出游戏为可执行文件#校园分享#
  • Unity如何导出资源包#校园分享#
  • Unity3D没有控制台(Console)窗口怎么办?
  • Uinty 3D如何添加脚本
  • 热门搜索
    ecm是什么意思 创意的意思 颐养天年的意思 五行是什么意思 什么去痘印 相机iso是什么意思 自然的意思 长沙有什么好玩的景点 凤仙花靠什么传播种子 打道回府的意思