diff --git a/NewHorizons/Builder/Props/DetailBuilder.cs b/NewHorizons/Builder/Props/DetailBuilder.cs index 19025ad6..cf71a50c 100644 --- a/NewHorizons/Builder/Props/DetailBuilder.cs +++ b/NewHorizons/Builder/Props/DetailBuilder.cs @@ -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}"); } diff --git a/NewHorizons/Handlers/PlanetCreationHandler.cs b/NewHorizons/Handlers/PlanetCreationHandler.cs index b67661d8..55d7db88 100644 --- a/NewHorizons/Handlers/PlanetCreationHandler.cs +++ b/NewHorizons/Handlers/PlanetCreationHandler.cs @@ -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); } }