diff --git a/Assets/_Content/Scenes/Theatre.unity b/Assets/_Content/Scenes/Theatre.unity index b494092e..4bf35427 100644 --- a/Assets/_Content/Scenes/Theatre.unity +++ b/Assets/_Content/Scenes/Theatre.unity @@ -15391,6 +15391,10 @@ PrefabInstance: propertyPath: _stressLevel value: 0.3 objectReference: {fileID: 0} + - target: {fileID: 1476756471834662335, guid: 6493d77978c5c1246a0410d1f9204524, type: 3} + propertyPath: _fadeDuration + value: 2 + objectReference: {fileID: 0} - target: {fileID: 1476756471834662335, guid: 6493d77978c5c1246a0410d1f9204524, type: 3} propertyPath: _idleAmplitude value: 0.5 @@ -15419,6 +15423,10 @@ PrefabInstance: propertyPath: _debugSustainStress value: 0 objectReference: {fileID: 0} + - target: {fileID: 1476756471834662335, guid: 6493d77978c5c1246a0410d1f9204524, type: 3} + propertyPath: _masterIntensityInspector + value: 1.5 + objectReference: {fileID: 0} - target: {fileID: 5295567073180248356, guid: 6493d77978c5c1246a0410d1f9204524, type: 3} propertyPath: _settings.CanRun value: 1 diff --git a/Assets/_Content/Scripts/Features/Player/Runtime/Camera/LostFootageRig.cs b/Assets/_Content/Scripts/Features/Player/Runtime/Camera/LostFootageRig.cs index 15930ea9..ae1ced9a 100644 --- a/Assets/_Content/Scripts/Features/Player/Runtime/Camera/LostFootageRig.cs +++ b/Assets/_Content/Scripts/Features/Player/Runtime/Camera/LostFootageRig.cs @@ -36,8 +36,11 @@ namespace Unheimlich.World.CameraSystem [Tooltip("Enable or disable the whole rig (with fade). Can also be toggled at runtime via SetActive().")] [SerializeField] private bool _isActive = true; - [Tooltip("Master scale applied to ALL effects (noise amplitude, jolt amplitude, inertia strength, spin strength). 0 = off, 1 = nominal.")] - [SerializeField] [Range(0f, 3f)] private float _masterIntensity = 1f; + [Tooltip("Master scale applied to ALL effects. This is the target value restored on Enable().")] + [SerializeField] [Range(0f, 3f)] private float _masterIntensityInspector = 1f; + + // Runtime value — starts at 0 if disabled, lerps to _masterIntensityInspector on Enable(). + private float _masterIntensity; // ── Inspector — Stress ──────────────────────────────────────────────────── @@ -140,7 +143,7 @@ namespace Unheimlich.World.CameraSystem // ── Runtime state ───────────────────────────────────────────────────────── private float _weight; - private float _initialMasterIntensity; // value set in inspector, restored on Enable() + private bool _started; private float _noiseTimer; private float _spinTimer; private Vector3 _noiseOffset; @@ -165,17 +168,16 @@ namespace Unheimlich.World.CameraSystem Random.Range(0f, 100f) ); - // Spin uses its own offset to decouple from the main noise. _spinTimer = Random.Range(0f, 100f); + + // _masterIntensity is a pure runtime field (not serialized) so this zero + // will never be overwritten by Unity's deserialization. + _masterIntensity = _isActive ? _masterIntensityInspector : 0f; } private void Start() { - // Store the inspector value so Enable() can restore it even if the rig - // started disabled (and _masterIntensity was faded to 0). - _initialMasterIntensity = _masterIntensity; - - // Sync inspector toggle on first frame. + _started = true; IsActive = _isActive; _weight = _isActive ? 1f : 0f; @@ -190,8 +192,7 @@ namespace Unheimlich.World.CameraSystem private void OnValidate() { - // Allow toggling _isActive from the inspector during Play mode. - if (!Application.isPlaying) return; + if (!Application.isPlaying || !_started) return; SetActive(_isActive); } @@ -290,7 +291,7 @@ namespace Unheimlich.World.CameraSystem // ── Public API ──────────────────────────────────────────────────────────── /// UnityEvent-friendly wrapper — enables with the inspector master intensity. - public void Enable() => Enable(_initialMasterIntensity, _stressLevel); + public void Enable() => Enable(_masterIntensityInspector, _stressLevel); /// UnityEvent-friendly wrapper — disables with a fade to 0. public void Disable() => Disable(0f);