From 2f913fc8b0d859045a1d3eab183c24cf90471f5b Mon Sep 17 00:00:00 2001 From: Joshua Thome Date: Tue, 18 Apr 2023 21:34:40 -0500 Subject: [PATCH] Fix NRE on spawned vessels with physics --- NewHorizons/Handlers/VesselWarpHandler.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/NewHorizons/Handlers/VesselWarpHandler.cs b/NewHorizons/Handlers/VesselWarpHandler.cs index 935c4399..91e52323 100644 --- a/NewHorizons/Handlers/VesselWarpHandler.cs +++ b/NewHorizons/Handlers/VesselWarpHandler.cs @@ -145,6 +145,7 @@ namespace NewHorizons.Handlers var hasParentBody = !string.IsNullOrEmpty(system.Config.Vessel?.vesselSpawn?.parentBody); var hasPhysics = system.Config.Vessel?.hasPhysics ?? !hasParentBody; + var planetGO = hasParentBody ? vesselObject.transform.parent.gameObject : null; if (hasPhysics) { @@ -167,8 +168,6 @@ namespace NewHorizons.Handlers var attachWarpExitToVessel = system.Config.Vessel?.warpExit?.attachToVessel ?? false; var warpExitParent = vesselWarpController._targetWarpPlatform.transform.parent; - var planetGO = hasPhysics ? vesselObject.transform.parent.gameObject : null; - var warpExit = GeneralPropBuilder.MakeFromExisting(vesselWarpController._targetWarpPlatform.gameObject, planetGO, null, system.Config.Vessel?.warpExit, parentOverride: attachWarpExitToVessel ? warpExitParent : null); if (attachWarpExitToVessel) {