mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Added backup for prop searching (very costly tho)
This commit is contained in:
parent
8e36f5b479
commit
fd8a95bb28
@ -100,9 +100,10 @@ namespace NewHorizons.Utility
|
||||
public static GameObject Find(string path)
|
||||
{
|
||||
var go = GameObject.Find(path);
|
||||
if(go == null)
|
||||
|
||||
var names = path.Split(new char[] { '\\', '/' });
|
||||
if (go == null)
|
||||
{
|
||||
var names = path.Split(new char[] { '\\', '/' });
|
||||
|
||||
// Get the root object and hope its the right one
|
||||
var root = GameObject.Find(names[0]);
|
||||
@ -143,6 +144,13 @@ namespace NewHorizons.Utility
|
||||
go = t.gameObject;
|
||||
}
|
||||
|
||||
if(go == null)
|
||||
{
|
||||
var name = names.Last();
|
||||
Logger.LogWarning($"Couldn't find object {path}, will look for potential matches for name {name}");
|
||||
go = FindObjectOfTypeAndName<GameObject>(name);
|
||||
}
|
||||
|
||||
return go;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user