diff --git a/com.unity.cinemachine/CHANGELOG.md b/com.unity.cinemachine/CHANGELOG.md index a00049347..b2c3a4ced 100644 --- a/com.unity.cinemachine/CHANGELOG.md +++ b/com.unity.cinemachine/CHANGELOG.md @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Unreleased ### Bugfixes +- CinemachineVolumeSettings: changes to Focal Length and Aperture settings were not being applied while auto-focus was enabled. - InheritPosition was not inheriting the camera position in all cases. ### Added diff --git a/com.unity.cinemachine/Runtime/PostProcessing/CinemachineVolumeSettings.cs b/com.unity.cinemachine/Runtime/PostProcessing/CinemachineVolumeSettings.cs index 567ac8bdf..f9a603b88 100644 --- a/com.unity.cinemachine/Runtime/PostProcessing/CinemachineVolumeSettings.cs +++ b/com.unity.cinemachine/Runtime/PostProcessing/CinemachineVolumeSettings.cs @@ -182,8 +182,7 @@ protected override void PostPipelineStageCallback( { if (extra.ProfileCopy == null) extra.CreateProfileCopy(Profile); - profile = extra.ProfileCopy; - if (profile.TryGet(out DepthOfField dof)) + if (extra.ProfileCopy.TryGet(out DepthOfField dof)) { float focusDistance = FocusOffset; if (FocusTracking == FocusTrackingMode.LookAtTarget) @@ -203,8 +202,14 @@ protected override void PostPipelineStageCallback( CalculatedFocusDistance = focusDistance = Mathf.Max(0, focusDistance); dof.focusDistance.value = focusDistance; state.Lens.PhysicalProperties.FocusDistance = focusDistance; - profile.isDirty = true; + if (profile.TryGet(out DepthOfField srcDof)) + { + dof.aperture.value = srcDof.aperture.value; + dof.focalLength.value = srcDof.focalLength.value; + } + extra.ProfileCopy.isDirty = true; } + profile = extra.ProfileCopy; } // Apply the post-processing state.AddCustomBlendable(new CameraState.CustomBlendableItems.Item { Custom = profile, Weight = Weight });