找回密码
 立即注册
查看: 7268|回复: 98

[脚本] Unity3D用代码创建对象并绑定脚本

[复制链接]
发表于 2013-5-22 13:55 | 显示全部楼层 |阅读模式
  1.     GameObject obj = new GameObject("Mission");
  2.         obj.AddComponent<UILabel>();
  3.         obj.GetComponent<UILabel>().text = "任务完成!";
  4.         obj.transform.parent = GameObject.Find("ABC").transform;
  5.         obj.transform.localPosition = new Vector3(0,0,0);
  6.         obj.transform.localScale = new Vector3(1,1,1);
复制代码
发表于 2013-6-8 01:15 | 显示全部楼层
谢谢楼主分享,不错的教程
发表于 2014-7-9 17:59 | 显示全部楼层
弱弱的问一句,哪句代码是绑定脚本的
发表于 2017-3-24 14:55 | 显示全部楼层
很不错
发表于 2017-3-24 15:42 | 显示全部楼层
楼主是超人
发表于 2017-3-24 14:52 | 显示全部楼层
顶顶多好
发表于 2017-3-24 15:42 | 显示全部楼层
说的非常好
发表于 2017-3-24 15:06 | 显示全部楼层
LZ真是人才
发表于 2017-3-30 14:02 | 显示全部楼层
很不错
发表于 2017-3-30 13:48 | 显示全部楼层
楼主是超人
懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Unity开发者联盟 ( 粤ICP备20003399号 )

GMT+8, 2024-5-5 15:19 , Processed in 0.250307 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表