【发布时间】:2021-11-09 18:38:21
【问题描述】:
我正在处理一个 C#/Unity 项目,我想知道 Cinemachine 虚拟摄影机何时完全过渡到另一个 Cinemachine 摄影机。我见过有人使用IsBlending,但我仍然不确定如何在我的项目中实现该代码。
我的代码是这样的..
private CinemachineBlend activeBlend = null;
public bool IsBlending { get { return activeBlend != null; } }
[SerializeField] private CinemachineVirtualCamera[] virtualCameras;
void TestItIsWorking()
{
virtualCameras[0].Priority = 10;
virtualCameras[1].Priority = 0; // -> this starts the blending the virtual camera
Debug.Log("this function is called"); // -> prints "this function is called"
Debug.Log(IsBlending); // -> prints false
}
所以我想我做错了什么,因为虚拟相机已经开始改变,我得到一个错误的值作为 IsBlending 布尔值。我还编写了 while 循环,而不仅仅是 Debug 记录 IsBlending 值,但结果仍然相同。我想在混合完成后立即运行另一个函数,所以如果有更好的解决方案,也请告诉我....
【问题讨论】:
-
据我所知,属性应该进入
StateDrivenCamera脚本本身...
标签: c# unity3d camera cinemachine