only find skybox if we need to destroy it

This commit is contained in:
JohnCorby 2022-07-23 18:04:57 -07:00
parent 551eeddfb9
commit 9717da115e

View File

@ -10,11 +10,9 @@ namespace NewHorizons.Handlers
{ {
public static void LoadSystem(NewHorizonsSystem system) public static void LoadSystem(NewHorizonsSystem system)
{ {
var skybox = SearchUtilities.Find("Skybox/Starfield");
if (system.Config.Skybox?.destroyStarField ?? false) if (system.Config.Skybox?.destroyStarField ?? false)
{ {
Object.Destroy(skybox); Object.Destroy(SearchUtilities.Find("Skybox/Starfield"));
} }
if (system.Config.Skybox?.rightPath != null || if (system.Config.Skybox?.rightPath != null ||