fix find again (#346)

dont include prefabs in search or else distant proxies break horribly
This commit is contained in:
Will Corby 2022-09-02 21:31:37 -07:00 committed by GitHub
commit e602354ac7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -119,9 +119,9 @@ namespace NewHorizons.Utility
var name = names.Last(); var name = names.Last();
if (warn) Logger.LogWarning($"Couldn't find object in path {path}, will look for potential matches for name {name}"); if (warn) Logger.LogWarning($"Couldn't find object in path {path}, will look for potential matches for name {name}");
// 3: find resource to include inactive objects // 3: find resource to include inactive objects (but skip prefabs
// also includes prefabs but hopefully thats okay go = Resources.FindObjectsOfTypeAll<GameObject>()
go = FindResourceOfTypeAndName<GameObject>(name); .FirstOrDefault(x => x.name == name && x.scene.name != null);
if (go) if (go)
{ {
CachedGameObjects.Add(path, go); CachedGameObjects.Add(path, go);