diff --git a/NewHorizons/Handlers/ShipLogHandler.cs b/NewHorizons/Handlers/ShipLogHandler.cs index 2ffb175f..3d3a3f6b 100644 --- a/NewHorizons/Handlers/ShipLogHandler.cs +++ b/NewHorizons/Handlers/ShipLogHandler.cs @@ -29,7 +29,7 @@ namespace NewHorizons.Handlers GameObject panRoot = SearchUtilities.Find(PAN_ROOT_PATH); if (panRoot != null) { - List gameObjects = SearchUtilities.GetAllChildren(panRoot); + List gameObjects = panRoot.GetAllChildren(); _vanillaBodies = gameObjects.ConvertAll(g => g.name).ToArray(); _vanillaBodyIDs = gameObjects.ConvertAll(g => g.GetComponent()?.GetID()).ToArray(); } diff --git a/NewHorizons/Patches/ShipLogPatches.cs b/NewHorizons/Patches/ShipLogPatches.cs index 00241e33..e61263be 100644 --- a/NewHorizons/Patches/ShipLogPatches.cs +++ b/NewHorizons/Patches/ShipLogPatches.cs @@ -145,7 +145,7 @@ namespace NewHorizons.Patches __instance._startingAstroObjectID = navMatrix[1][0].GetID(); if (Main.Instance.CurrentStarSystem != "SolarSystem") { - List delete = SearchUtilities.GetAllChildren(panRoot).Where(g => g.name.Contains("_ShipLog") == false).ToList(); + List delete = panRoot.GetAllChildren().Where(g => g.name.Contains("_ShipLog") == false).ToList(); foreach (GameObject gameObject in delete) { Object.Destroy(SearchUtilities.Find(ShipLogHandler.PAN_ROOT_PATH + "/" + gameObject.name)); @@ -182,7 +182,7 @@ namespace NewHorizons.Patches Transform detailsParent = __instance.transform.Find("Details"); if (detailsParent != null) { - foreach (GameObject child in SearchUtilities.GetAllChildren(detailsParent.gameObject)) + foreach (GameObject child in detailsParent.gameObject.GetAllChildren()) { if (child.TryGetComponent(typeof(ShipLogDetail), out Component detail)) { diff --git a/NewHorizons/Utility/SearchUtilities.cs b/NewHorizons/Utility/SearchUtilities.cs index b5c1aea5..7db522b9 100644 --- a/NewHorizons/Utility/SearchUtilities.cs +++ b/NewHorizons/Utility/SearchUtilities.cs @@ -160,7 +160,7 @@ namespace NewHorizons.Utility } } - public static List GetAllChildren(GameObject parent) + public static List GetAllChildren(this GameObject parent) { List children = new List(); foreach (Transform child in parent.transform)