Unity2018编辑模式通过GameObject查找prefab

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

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

你可能感兴趣的:(unity,PrefabUtility)