Skip to content

Commit a916bf1

Browse files
committed
fix: Fixed the prefabs not being found in ProjectWideSearcher
1 parent fc61190 commit a916bf1

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Editor/Helpers/ProjectWideSearcher.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,20 +76,22 @@ private static IEnumerable<SerializedObject> GetSerializedObjectsFromPrefabs()
7676

7777
foreach (var prefabGUID in prefabGUIDs)
7878
{
79-
string prefabPath = AssetDatabase.AssetPathToGUID(prefabGUID);
79+
string prefabPath = AssetDatabase.GUIDToAssetPath(prefabGUID);
8080

8181
if (string.IsNullOrEmpty(prefabPath))
8282
continue;
83-
83+
8484
var rootGameObject = PrefabUtility.LoadPrefabContents(prefabPath);
85-
85+
8686
if (rootGameObject == null)
8787
continue;
8888

8989
foreach (var serializedObject in GetSerializedObjectsFromGameObject(rootGameObject))
9090
{
9191
yield return serializedObject;
9292
}
93+
94+
PrefabUtility.UnloadPrefabContents(rootGameObject);
9395
}
9496
}
9597

@@ -107,6 +109,7 @@ private static IEnumerable<SerializedObject> GetSerializedObjectsFromScriptableO
107109
continue;
108110

109111
yield return new SerializedObject(scriptableObject);
112+
Resources.UnloadAsset(scriptableObject);
110113
}
111114
}
112115
}

0 commit comments

Comments
 (0)