add a final warn in Find lol

This commit is contained in:
JohnCorby 2022-08-08 13:21:23 -07:00
parent 2ef5582c83
commit c444b6fdb2

View File

@ -105,7 +105,7 @@ namespace NewHorizons.Utility
var root = SceneManager.GetActiveScene().GetRootGameObjects().FirstOrDefault(x => x.name == rootName); var root = SceneManager.GetActiveScene().GetRootGameObjects().FirstOrDefault(x => x.name == rootName);
if (root == null) if (root == null)
{ {
if (warn) Logger.LogWarning($"Couldn't find root object in path ({path})"); if (warn) Logger.LogWarning($"Couldn't find root object in path {path}");
return null; return null;
} }
@ -114,11 +114,15 @@ namespace NewHorizons.Utility
if (go == null) if (go == null)
{ {
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}");
// find resource to include inactive objects // find resource to include inactive objects
// also includes prefabs but hopefully thats okay // also includes prefabs but hopefully thats okay
go = FindResourceOfTypeAndName<GameObject>(name); go = FindResourceOfTypeAndName<GameObject>(name);
if (go == null) return null; if (go == null)
{
if (warn) Logger.LogWarning($"Couldn't find object with name {name}");
return null;
}
} }
} }