mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Fix SearchUtilities find method
This commit is contained in:
parent
1a0ac92de7
commit
5afdbd94c3
@ -115,33 +115,34 @@ namespace NewHorizons.Utility
|
|||||||
if (t == null)
|
if (t == null)
|
||||||
{
|
{
|
||||||
Logger.LogWarning($"Couldn't find root object in path ({names[0]})");
|
Logger.LogWarning($"Couldn't find root object in path ({names[0]})");
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
for (int i = 1; i < names.Length; i++)
|
|
||||||
{
|
{
|
||||||
var child = t.transform.Find(names[i]);
|
for (int i = 1; i < names.Length; i++)
|
||||||
|
|
||||||
if (child == null)
|
|
||||||
{
|
{
|
||||||
foreach (Transform c in t.GetComponentsInChildren<Transform>(true))
|
var child = t.transform.Find(names[i]);
|
||||||
|
|
||||||
|
if (child == null)
|
||||||
{
|
{
|
||||||
if (t.name.Equals(names[i]))
|
foreach (Transform c in t.GetComponentsInChildren<Transform>(true))
|
||||||
{
|
{
|
||||||
child = c;
|
if (t.name.Equals(names[i]))
|
||||||
break;
|
{
|
||||||
|
child = c;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (child == null)
|
if (child == null)
|
||||||
{
|
{
|
||||||
Logger.LogWarning($"Couldn't find object in path ({names[i]})");
|
Logger.LogWarning($"Couldn't find object in path ({names[i]})");
|
||||||
t = null;
|
t = null;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
t = child;
|
t = child;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
go = t?.gameObject;
|
go = t?.gameObject;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user