Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug Errors updating to Cinemachine 2.9.5 on Unity 2021.3.22f1

Discussion in 'Cinemachine' started by ShervinM, Apr 17, 2023.

  1. ShervinM

    ShervinM

    Joined:
    Sep 16, 2017
    Posts:
    67
    Hi there,

    I'm updating the Cinemachine asset in our project from 2.8.9 to 2.9.5 by going into the manifest.json.

    The project is on Unity 2021.3.22f1

    Upon re-focusing on Unity, it does its thing, and seems to update the package just fine. However, the moment I select any GameObject with a CinemachineVirtualCamera component and look at the inspector, my console is non-stop flooded with the following errors:

    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. Cinemachine.Editor.CinemachineSceneToolUtility+<>c.<.cctor>b__21_0 () (at Library/PackageCache/com.unity.cinemachine@2.9.5/Editor/Utility/CinemachineSceneTools.cs:272)
    3. UnityEditor.EditorApplication.Internal_CallUpdateFunctions () (at <964670f15c6b47f9b8f9340732720473>:0)
    4.  
    5. NullReferenceException: Object reference not set to an instance of an object
    6. Cinemachine.Editor.CinemachineSceneToolUtility+<>c.<.cctor>b__21_0 () (at Library/PackageCache/com.unity.cinemachine@2.9.5/Editor/Utility/CinemachineSceneTools.cs:272)
    7. UnityEditor.EditorApplication.Internal_CallUpdateFunctions () (at <964670f15c6b47f9b8f9340732720473>:0)
    8.  
    What's interesting is that if I try to update a branch new project (with the same version of unity) I do not run into this issue. Any ideas?

    Some notes:
    - I'm updating to 2.9.5 through the manifest as it seems that 2.9.5 is not an official release of Cinemachine for Unity version 2021.3.22f1
    - I tried going to the Library/PackageCache and completely wiping the folder before re-installing the package. No luck :(

    Any help would be greatly appreciated!
     
  2. antoinecharton

    antoinecharton

    Unity Technologies

    Joined:
    Jul 22, 2020
    Posts:
    189
    Heyyoo

    I tried to repro but couldn't. Do you think you could send us a repro project? What happens if you update through the pack man window? Can you try clearing your library folder close unity and reopen (Backup your project first)?

    Let us know
     
    ShervinM likes this.
  3. ShervinM

    ShervinM

    Joined:
    Sep 16, 2017
    Posts:
    67
    Hey Antoine, thank you for the quick reply!

    I can't update through the pack man window as it only shows
    2.8.9
    as the latest available version for Unity 2021.3.22f1. I see 2.8.9 as the latest version both for my project, and branch new repro projects with the same Unity version (hence why updated by manually changing the manifest.json).

    I'll try clearing the entire library folder and see what happens.

    As for repro, I can't seem to repro this issue in a new project (same unity version), seems to only happen with my current project. If I have to share it, I'll have to probably downsize the project a bit. Where would I share it?
     
  4. baumxyz

    baumxyz

    Joined:
    Mar 31, 2017
    Posts:
    107
    Hey, I have the same problem. Unity 2021.3.22f1 and the latest version of Cinemachine in the Package Manager is 2.8.9. How do you get 2.9+ into your own project? I also deleted the Library folder, but the highest version is still 2.8.9.

    Edit: I think I got it working:

    Package Manager -> + -> Add package by name...

    Name: com.unity.cinemachine
    Version: 2.9.5

    And it seems to work. BUT... I get the following warning inside the package manager:

    Screenshot 2023-04-21 164430.png

    The 2021.3 Unity Manual states that this Cinemachine version is supported:

    Screenshot 2023-04-21 164730.png
     
    Last edited: Apr 21, 2023
    KRWatkins likes this.
  5. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,552
    Yes, that is the correct way to install. Unfortunately the 2.8.9 version limit is baked into Unity. We're working on getting that removed so that you always see the true latest version in package manager. Don't worry about the not-verified thing, 2.9.5 is compatible.
     
    ShervinM and baumxyz like this.
  6. ShervinM

    ShervinM

    Joined:
    Sep 16, 2017
    Posts:
    67
    Just to close this thread up: I got it to work using the following steps:

    1. Close Unity
    2. Wipe the library folder
    3. Edit Packages\manifest.json to update cinemachine entry to 2.9.5
    4. Remove cinemachine entry in packages-lock.json
    5. Open Unity (project will take a while to re-import library)

    Thanks for the help!
     
    antoinecharton and Gregoryl like this.
  7. Elliott-Mitchell

    Elliott-Mitchell

    Joined:
    Oct 8, 2015
    Posts:
    87
    I get the same console spam errors when selecting a virtual camera in the hierarchy AND when creating a new virtual camera in a scene .

    I've been seeing this error in 2.9.5 and 2.9.7 for a while and it's been driving me insane. When I roll back Cinemachine to 2.8.9, the error is no longer present.

    The actual solution to remedy this error in 2.9.5 and 2.9.7 is to reset the Unity Editor to the default layout. Crazy, huh?
     
  8. antoinecharton

    antoinecharton

    Unity Technologies

    Joined:
    Jul 22, 2020
    Posts:
    189
    Can you describe your layout or take a screenshot? Do you have something like 2 Inspector window?
     
  9. Elliott-Mitchell

    Elliott-Mitchell

    Joined:
    Oct 8, 2015
    Posts:
    87
    Basically this. There may have been two inspector panels at some point, but this is my layout preset.
     

    Attached Files:

  10. nam-hd23

    nam-hd23

    Joined:
    Aug 3, 2013
    Posts:
    5
    Hi,
    I upgrade my project to 2022.3.9 and virtual camera can go outside border when play. This's a bug?
    upload_2023-9-8_13-52-55.png
    P/S: I check again and find difference:
    -2.8.9: when virtual camera change size , confiner will update
    -2.9.7: confiner don't update and need call Invalidate Cache manual
     
    Last edited: Sep 8, 2023
  11. antoinecharton

    antoinecharton

    Unity Technologies

    Joined:
    Jul 22, 2020
    Posts:
    189
    Try clicking invalidate cache if the camera is still off that may be a bug.
     
  12. nam-hd23

    nam-hd23

    Joined:
    Aug 3, 2013
    Posts:
    5
    In Play Mode if virtual camera zoom will over confiner
     
  13. antoinecharton

    antoinecharton

    Unity Technologies

    Joined:
    Jul 22, 2020
    Posts:
    189
    Hello again,

    We don't recommend changing orthographic size when using the confiner. It's something we experimented with in the past but the performance cost of updating the confiner would be too high.

    The way around that would be to have one virtual camera per size you would need with their own confiner and switching vcam when you need a different orthographic size.

    Let us know if that helps :)