Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Error when animate the FOV of a virtuel camera

Discussion in 'Cinemachine' started by WeiWuDe, Aug 13, 2021.

  1. WeiWuDe

    WeiWuDe

    Joined:
    Nov 3, 2020
    Posts:
    26
    Hi,

    ich got the error each fram when i animate the FOV of a virtuel camera:

    Assertion failed on expression: 'SUCCEEDED(hr)'

    this error does not crash my game, even can run, but i still can feel that animation of FOV is not very smooth, what is happens and how can i get ride of this error?

    thanks in advance :)
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,267
    Normally there should not be an error.
    How are you animating the FOV?
     
  3. WeiWuDe

    WeiWuDe

    Joined:
    Nov 3, 2020
    Posts:
    26
    i use the animation in Unity and set the FOV with 8 at 0 fram in the end FOV with 25, every fram shows the error when the animation plays....
     
  4. sjwewuuu

    sjwewuuu

    Joined:
    Nov 27, 2019
    Posts:
    3
    New
    i use the animation in Unity and set the FOV with 8 at 0 fram in the end FOV with 25, every fram shows the error when the animation plays....
     
  5. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,267
    I still don't understand from your description. This is not an error we have seen before. Normally animating the FOV does not cause a problem. Can you make a small project that reproduces the problem and log a bug?
     
  6. Leuthil

    Leuthil

    Joined:
    Jul 26, 2013
    Posts:
    97
    @Gregoryl I actually am getting this error as well when doing the exact same thing, although everything seems to function as expected so I'm not sure what it means. I'm doing this with a 3rd Person Follow vcam. This is the code I'm using:

    Code (CSharp):
    1. m_vCam.m_Lens.FieldOfView = Mathf.MoveTowards(m_vCam.m_Lens.FieldOfView, ZoomedFieldOfView, MaxFieldOfViewDeltaPerSecond * Time.deltaTime);
    I'm probably going to change the solution to instead blend to a completely separate vcam since I may want to change more than just the FOV in the future, but still an interesting issue.

    Edit: I actually get this issue even when blending to a camera with a different FOV. I'll see if I can make a small repro project.
     
    Last edited: Oct 25, 2021
    Gregoryl likes this.
  7. Leuthil

    Leuthil

    Joined:
    Jul 26, 2013
    Posts:
    97
    @Gregoryl Just updated to the latest LTS version 2020.3.21f1 from version 2020.3.13f1. So far I haven't encountered the issue. If I ever encounter it again I will try to isolate the problem, but it seems fixed. For the record I actually noticed that the error would even happen sometimes when just selecting a GameObject and focusing on it (pressing F), so it seemed like some general underlying issue, not specific to FOV.

    Edit: I take it back. Just encountered it again when resizing the Game window in editor while the game was playing. I'll try to make a repro project tomorrow.
     
    Last edited: Oct 26, 2021
    Gregoryl and WeiWuDe like this.
  8. Leuthil

    Leuthil

    Joined:
    Jul 26, 2013
    Posts:
    97
    Unfortunately I wasn't able to reproduce this in a brand new project. I thought maybe it is due to Cinemachine as it is camera related, but adding Cinemachine didn't reproduce the problem either. It is intermittent and doesn't seem to affect anything and I just don't have the time to try to slowly strip things out until I figure it out. If I ever figure it out by accident I'll post back here.