Hi! I´ve been developing a tool that automaticaly changes the depth of field from a cinemachine virtual camera volume. When I update the values they change in editor, and modify the view as they are supposed, but when I try to modify again the values through editor, the view no longer changes until I save and reload the scene. Here is the code:
var cmBrain = Camera.main.GetComponent<CinemachineBrain>();
if (cmBrain == null) return;
var cmLive = cmBrain.ActiveVirtualCamera;
if (cmLive == null) return;
var volume = cmLive.VirtualCameraGameObject.GetComponent<CinemachineVolumeSettings>();
VolumeProfile volumeProfile = volume.m_Profile;
DepthOfField tmp;
if (volumeProfile.TryGet<DepthOfField>(out tmp))
{
dofComponent = tmp;
}
Undo.RecordObject(dofComponent, volume.name);
dofComponent.nearFocusEnd = new MinFloatParameter(minmax.x, 0f, true);
dofComponent.farFocusStart = new MinFloatParameter(minmax.y, 0f, true);
volume.m_Profile = volumeProfile;
Thanks for the help! ^^