unity未实例化报错:Setting the parent of a transform which resides in a Prefab

unity未实例化报错,无法设置父对象

unity报错

:Setting the parent of a transform which resides in a Prefab

1.日志

Setting the parent of a transform which resides in a Prefab Asset is disabled to prevent data corruption"

2.翻译

设置位于预置资产中的转换的父元素是禁用的,以防止数据损坏

3.方案

加载出来的预制体进行实例化:

Instantiate();

4.示例

int ran = Random.Range(1, 6);
var brid_x = Resources.Load<GameObject>("Bird" + ran.ToString());
brid_x = Instantiate(brid_x);

brid_x.transform.SetParent_ResetAll(Content[index_]); //链式调用

猜你喜欢

转载自blog.csdn.net/weixin_38531633/article/details/119156332