- Home /
Unity Cinemachine error: Assertion failed on expression: 'CompareApproximately(det, 1.0F, .005f)'
I am using the Cinemachine asset available on the Unity Asset Store and getting a bunch of exceptions. Although they don't seem to have any effect on my game as such, but still I'd prefer to get rid of them. The exceptions appear only when I unpause a paused game (using Time.timeScale
), and not otherwise.
Stack trace of exceptions below:
Assertion failed: Assertion failed on expression: 'CompareApproximately(det, 1.0F, .005f)'
UnityEngine.Quaternion:FromToRotation(Vector3, Vector3)
Cinemachine.Utility.PositionPredictor:PredictPosition(Single) (at Assets/Cinemachine/Base/Runtime/Core/Predictor.cs:64)
Cinemachine.CinemachineFramingTransposer:MutateCameraState(CameraState&, Single) (at Assets/Cinemachine/Base/Runtime/Components/CinemachineFramingTransposer.cs:318)
Cinemachine.CinemachineVirtualCamera:CalculateNewState(Vector3, Single) (at Assets/Cinemachine/Base/Runtime/Behaviours/CinemachineVirtualCamera.cs:426)
Cinemachine.CinemachineVirtualCamera:UpdateCameraState(Vector3, Single) (at Assets/Cinemachine/Base/Runtime/Behaviours/CinemachineVirtualCamera.cs:128)
Cinemachine.CinemachineCore:UpdateVirtualCamera(ICinemachineCamera, Vector3, Single) (at Assets/Cinemachine/Base/Runtime/Core/CinemachineCore.cs:237)
Cinemachine.CinemachineCore:UpdateAllActiveVirtualCameras(Vector3, Single) (at Assets/Cinemachine/Base/Runtime/Core/CinemachineCore.cs:165)
Cinemachine.CinemachineBrain:UpdateVirtualCameras(UpdateFilter, Single) (at Assets/Cinemachine/Base/Runtime/Behaviours/CinemachineBrain.cs:445)
Cinemachine.CinemachineBrain:LateUpdate() (at Assets/Cinemachine/Base/Runtime/Behaviours/CinemachineBrain.cs:399)
Below is the script responsible for pausing and unpausing the game:
public void PauseGame()
{
if (pauseMenuCanvas)
{
Time.timeScale = 0f;
pauseKeyDisabled = true;
if (pauseMenuPanel)
{
pauseMenuPanel.SetActive(true);
pauseMenuPanel.GetComponent<CanvasGroup>().interactable = true;
if (pauseMenuPanelAnimator == null)
pauseMenuPanelAnimator = pauseMenuPanel.GetComponent<Animator>();
pauseMenuPanelAnimator.SetTrigger("Open");
if (!helptextPopulated)
{
helptextPopulated = true;
helptext.text += "\n\n<align=left>" + GameSession.contentInfotext;
}
}
}
gamePaused = true;
pauseKeyDisabled = false;
}
IEnumerator UnPauseCoRoutine()
{
pauseKeyDisabled = true;
Time.timeScale = 1;
if (pauseMenuPanel.activeSelf)
{
pauseMenuPanelAnimator.SetTrigger("Close");
pauseMenuPanel.GetComponent<CanvasGroup>().interactable = false;
}
if (helpPanel.activeSelf)
{
if (helpPanelAnimator == null)
{
helpPanelAnimator = helpPanel.GetComponent<Animator>();
helpPanel.GetComponent<CanvasGroup>().interactable = false;
}
helpPanelAnimator.SetTrigger("Close");
}
if (audioPanel.activeSelf)
{
if (audioPanelAnimator == null)
{
audioPanel.GetComponent<CanvasGroup>().interactable = false;
audioPanelAnimator = audioPanel.GetComponent<Animator>();
}
audioPanelAnimator.SetTrigger("Close");
}
RuntimeAnimatorController ac = pauseMenuPanelAnimator.runtimeAnimatorController;
yield return new WaitForSeconds(ac.animationClips[0].length); // use any animation from the array, as all have same length
pauseMenuPanel.SetActive(false);
helpPanel.SetActive(false);
audioPanel.SetActive(false);
gamePaused = false;
pauseKeyDisabled = false;
}
Answer by EnergyTeamDummies · Aug 13, 2021 at 04:52 PM
@vverma9 hello, the time scale stops the fixed update but not the update or the coroutines, in updated method of [Cinemachine Brain] you must select "Fixed Update"
Your answer
![](https://koobas.hobune.stream/wayback/20220612193810im_/https://answers.unity.com/themes/thub/images/avi.jpg)