当前位置:   article > 正文

【Unity报错】Setting the parent of a transform which resides in a prefab is disabled to prevent data cor

setting the parent of a transform which resides in a prefab asset is disable

Setting the parent of a transform which resides in a prefab is disabled to prevent data corruption.

加载一个Resources文件夹下的预制体到场景中,未经实例化过程,就为其指定parent。


正确使用方式:

  1. GameObject obj = (GameObject)Resources.Load("fbx/ying1/ying1");//加载预制体
  2. obj = Instantiate(obj);//实例化预制体
  3. GameObject parent = GameObject.Find("parent");//寻找父物体
  4. obj.transform.parent = parent.transform;//指定父物体


声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/花生_TL007/article/detail/111280
推荐阅读
相关标签
  

闽ICP备14008679号