fix(camera): 修复立即切换相机时 CustomBlend 仍生效
This commit is contained in:
@@ -182,11 +182,15 @@ namespace AibisDream.Framework
|
||||
var activeBrain = _orthoCameraBrain;
|
||||
|
||||
CinemachineBlendDefinition originalBlend = default;
|
||||
CinemachineBlenderSettings savedCustomBlends = null;
|
||||
if (immediate)
|
||||
{
|
||||
originalBlend = activeBrain.m_DefaultBlend;
|
||||
activeBrain.m_DefaultBlend = new CinemachineBlendDefinition(
|
||||
CinemachineBlendDefinition.Style.Cut, 0f);
|
||||
// Custom Blends 会覆盖 DefaultBlend;immediate 时必须临时禁用,否则仍走 1s 缓动。
|
||||
savedCustomBlends = activeBrain.m_CustomBlends;
|
||||
activeBrain.m_CustomBlends = null;
|
||||
}
|
||||
|
||||
_virtualCameraDict.TryGetValue(_curCameraEnum, out var fromVCam);
|
||||
@@ -205,8 +209,14 @@ namespace AibisDream.Framework
|
||||
if (immediate)
|
||||
{
|
||||
ResetVirCam(lastCamEnum);
|
||||
activeBrain.ManualUpdate();
|
||||
var blend = originalBlend;
|
||||
ActionKit.Delay(0f, () => activeBrain.m_DefaultBlend = blend).StartGlobal();
|
||||
var customBlends = savedCustomBlends;
|
||||
ActionKit.DelayFrame(2, () =>
|
||||
{
|
||||
activeBrain.m_DefaultBlend = blend;
|
||||
activeBrain.m_CustomBlends = customBlends;
|
||||
}).StartGlobal();
|
||||
return 0f;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user