From 59721b1f555c7dabf93d6ce60d63bdeb18e6701f Mon Sep 17 00:00:00 2001 From: Nick Date: Sat, 25 Mar 2023 12:14:13 -0400 Subject: [PATCH] Fix RingOpacityController NRE --- .../Components/RingOpacityController.cs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/NewHorizons/Components/RingOpacityController.cs b/NewHorizons/Components/RingOpacityController.cs index 0f762506..913230c4 100644 --- a/NewHorizons/Components/RingOpacityController.cs +++ b/NewHorizons/Components/RingOpacityController.cs @@ -25,10 +25,22 @@ namespace NewHorizons.Components CurrentOpacity = 1; } - if (_ringFluidVolume != null) + if (_ringFluidVolume != null && _ringFluidVolume.gameObject.activeInHierarchy) { - if (Mathf.Approximately(CurrentOpacity, 0) && _ringFluidVolume.IsVolumeActive()) _ringFluidVolume.SetVolumeActivation(false); - else if (!_ringFluidVolume.IsVolumeActive()) _ringFluidVolume.SetVolumeActivation(true); + if (Mathf.Approximately(CurrentOpacity, 0)) + { + if (_ringFluidVolume.IsVolumeActive()) + { + _ringFluidVolume.SetVolumeActivation(false); + } + } + else + { + if (!_ringFluidVolume.IsVolumeActive()) + { + _ringFluidVolume.SetVolumeActivation(true); + } + } } if (_meshRenderer == null) return;