ITeye博客

Unity2018编辑模式通过GameObject查找prefab

贝壳水母 · 2019-07-18 09:58 · 移动开发 · Markdown


var prefabObj = PrefabUtility.GetCorrespondingObjectFromSource(childTrans.gameObject);
if (!prefabObj)
{
    continue;
}

string prefabPath = PrefabUtility.GetPrefabAssetPathOfNearestInstanceRoot(prefabObj);
if (string.IsNullOrEmpty(prefabPath))
{
    Debug.Log("cant find prefabPath");
    continue;
}

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。