找回密码
 立即注册
楼主: 孙佳

[脚本] 动态创建新物体

[复制链接]
发表于 2013-5-24 10:57 | 显示全部楼层 |阅读模式
var newpoint : Vector3.zero ;
var mesh1 : GameObject ;

function Start () {
if(Input.GetKeyDown(KeyCode.Mouse0)){
newpoint = hit.point;
}
mesh1 = Instantiate(Resources.Load("model"));//加载模型
mesh1.transform.position = Vector3(newpoint[0],transform.position.y,newpoint[2]);//新模型出现的位置,并同时销毁旧物体
Destroy(transform);
}

请问以上脚本中有什么错误呢?
发表于 2013-5-26 21:27 | 显示全部楼层
mesh1 换成 GameObject Obj
不需要每个都绑定对象
发表于 2017-2-25 19:01 | 显示全部楼层
好帖就是要顶
发表于 2017-2-25 19:33 | 显示全部楼层
顶顶多好
发表于 2017-2-25 18:55 | 显示全部楼层
难得一见的好帖
发表于 2017-2-25 19:30 | 显示全部楼层
很好哦
发表于 2017-2-25 19:35 | 显示全部楼层
LZ真是人才
发表于 2017-3-10 17:14 | 显示全部楼层
很不错
发表于 2017-3-10 17:24 | 显示全部楼层
好帖就是要顶
发表于 2017-3-10 17:18 | 显示全部楼层
真心顶
懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2024-5-13 06:24 , Processed in 0.092237 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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