mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Only find active objects when doing RemoveChildren
This commit is contained in:
parent
dffb767fc8
commit
21f9d3a5e7
@ -41,7 +41,9 @@ namespace NewHorizons.Builder.Props
|
||||
{
|
||||
foreach (var childPath in detail.removeChildren)
|
||||
{
|
||||
var childObj = detailGO.transform.Find(childPath);
|
||||
// We purposefully use GameObject.Find here because we don't want to find inactive things.
|
||||
// If you were to try and disable two children with the same name, if we were finding inactive then we'd disable the first one twice
|
||||
var childObj = GameObject.Find($"{SearchUtilities.GetPath(detailGO.transform)}/{childPath}");
|
||||
if (childObj != null) childObj.gameObject.SetActive(false);
|
||||
else Logger.LogWarning($"Couldn't find {childPath}");
|
||||
}
|
||||
|
||||
@ -252,6 +252,8 @@ namespace NewHorizons.Handlers
|
||||
{
|
||||
foreach (var child in body.Config.removeChildren)
|
||||
{
|
||||
// We purposefully use GameObject.Find here because we don't want to find inactive things.
|
||||
// If you were to try and disable two children with the same name, if we were finding inactive then we'd disable the first one twice
|
||||
Main.Instance.ModHelper.Events.Unity.FireInNUpdates(() => GameObject.Find(go.name + "/" + child)?.SetActive(false), 2);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user