Search Unity

Priority not being correctly updated.

Discussion in 'Cinemachine' started by pushxtonotdie, Sep 25, 2019.

  1. pushxtonotdie

    pushxtonotdie

    Joined:
    Oct 21, 2010
    Posts:
    111
    Hello, I'm new to Cinemachine (using 2.2.9) and I really like it, but I've been having a lot of trouble with its priority queue not correctly updating. I'm not sure if I'm doing something particularly wrong but I have had a couple different problems. One is that I would change the priority of a vcam, expecting it to get a higher priority item updated, but instead it does not. I've also had issues where it won't immediately update, and instead it will take a frame, meaning i get weird hitches where it will start transitioning to something, then one frame later pick another camera and start transitioning to that instead. I've gone through the source and while I don't have a smoking gun or a repro I can fix the issue by calling MoveToTopOfPrioritySubqueue() when i change the priority, which will correctly add the vcam at the appropriate point in the p-queue.

    I have set my UpdateType to AlwaysUpdate in hopes that might help. My vcams are static in the scene, with no vcams as parents to others. Something tells me the UpdateVcamPoolStatus() call that should happen in Update is not happening, perhaps because my code is setting the priority in its Update() after the Update() for CinemachineVirtualCameraBase has already executed.
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    Yes, it probably has to do with Update order. Instead of messing with priorities, you could try activating/deactivating the vcams to make the switch. You'll get better performance that way too.
     
  3. pushxtonotdie

    pushxtonotdie

    Joined:
    Oct 21, 2010
    Posts:
    111
    I was under the impression that changing the Priority was the correct way to change the current virtual camera. Is disabling and re-enabling the camera the correct way of doing this? Should I be leaving the priority alone and doing that instead?
     
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    Activating/deactivating the vcam game object is a good way. It tends to be simpler than managing priorities.