找回密码
 立即注册
查看: 8082|回复: 95

[BUG] 如何实例化一个对象放在另一个对象的子物体中

[复制链接]
发表于 2013-3-13 14:00 | 显示全部楼层 |阅读模式
    sprite1.transform.parent= ((GameObject)Instantiate(preFab, new Vector3(sprite1.transform.position.x, sprite1.transform.position.y, -0.009681821f), Quaternion.identity)).transform;

不正确 错哪了
InvalidCastException: Cannot cast from source type to destination type.
Server+<AwakeWait>c__Iterator3.MoveNext () (at Assets/Scripts/Server.cs:35)
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
Server:Awake() (at Assets/Scripts/Server.cs:26)


发表于 2017-4-10 22:08 | 显示全部楼层
好帖就是要顶
发表于 2017-4-10 21:35 | 显示全部楼层
顶顶多好
发表于 2017-4-10 21:12 | 显示全部楼层
真心顶
发表于 2017-4-10 21:10 | 显示全部楼层
难得一见的好帖
发表于 2017-4-10 21:49 | 显示全部楼层
LZ真是人才
发表于 2017-5-11 10:54 | 显示全部楼层
顶顶多好
发表于 2017-5-11 10:53 | 显示全部楼层
真心顶
发表于 2017-5-11 10:34 | 显示全部楼层
难得一见的好帖
发表于 2017-5-11 10:09 | 显示全部楼层
很好哦
懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2024-5-3 19:53 , Processed in 0.179746 second(s), 25 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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