Unity2018编辑模式通过GameObject查找prefab unityPrefabUtilityGetPrefabAssetPathOfNearestInstanceRoot
程序员文章站
2022-05-17 15:48:05
...
var prefabObj = PrefabUtility.GetCorrespondingObjectFromSource(childTrans.gameObject); if (!prefabObj) { continue; } string prefabPath = PrefabUtility.GetPrefabAssetPathOfNearestInstanceRoot(prefabObj); if (string.IsNullOrEmpty(prefabPath)) { Debug.Log("cant find prefabPath"); continue; }