Search Unity

lowering the priority to a virtual camera does not switch the active camera.

Discussion in 'Cinemachine' started by Lune, Feb 12, 2018.

  1. Lune

    Lune

    Joined:
    Oct 20, 2012
    Posts:
    62
    For this example lets say i have 3 cameras, A, B and C

    A priority is 5, B priority is 10 and C priority is 0, if i change C priority to 15, cinemachine brain blends perfectly but then if i lower C back to 0 cinemachine brain is not blending back towards B which his priority was 10.

    Am i doing something wrong? or is this a bug?

    Ty!
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,730
    It works for me.
    How exactly are you manipulating the priorities?
    Can you send a picture of your project hierarchy showing the vcams?
     
  3. Lune

    Lune

    Joined:
    Oct 20, 2012
    Posts:
    62
    the virtual cameras i have are all on prefabs as i just created some trigger zones to activate them, all those cameras have priority 5 when active, i also have cutscene cameras (not prefabs) with value 0 when not active and 15 when a cutscene is active.

    However after tracking the issue a bit more, seems like when i set the value of a cutscene camera to 15 the value of the trigger camera is returned to 0 (the default prefab value, maybe is a prefab reset?)
     
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,730
    I don't see why the prefab would reset all by itself
     
  5. Lune

    Lune

    Joined:
    Oct 20, 2012
    Posts:
    62
    i will try to replicate this on a small project, I am modifying the CinemachineVirtualCamera.m_Priority, should i be using ICinemachineCamera.Priority instead?
     
  6. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,730
    Same thing. A repro project would help :)
     
  7. BrandStone

    BrandStone

    Joined:
    Jul 21, 2014
    Posts:
    79
    I have the same problem with priorities, they don’t work. Here is a print screen with a simple scene.



    Vcam 1 should be the active camera but it's not. I also tried setting "Enable all child cameras" option and I get the same behaviour.

    Only manually changing the order in the inspector works. Is this a bug?
    I have the latest Cinemachine version installed.
     
  8. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,730
    @BrandStone I don't understand why you're using the StateDrivenCamera in this context. Because your state list is empty, the SDC will just default to the first camera in the list. Priorities aren't relevant here.
     
  9. BrandStone

    BrandStone

    Joined:
    Jul 21, 2014
    Posts:
    79
    @Gregoryl Thanks for the fast reply. It seems that I misunderstood the purpose of the StateDrivenCamera. I just want to change from one camera to the next from script (orbit / aim) when some conditions are met (not bound to animator controller).

    Is there a better component for achieving this?
     
  10. BrandStone

    BrandStone

    Joined:
    Jul 21, 2014
    Posts:
    79
    @Gregoryl I figured it out, not using the StateDrivenCamera at all did the trick :)
    Thanks a lot for the help!
     
  11. Juliken

    Juliken

    Joined:
    Jan 30, 2017
    Posts:
    17
    I have the same problem without the StateDrivenCamera. I set all my camera priority to 1 and the camera I want to something like 10. The Cinemachine brain choose a random virtual cam with priority of 1.
     
  12. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,730
    Can you give some details about how you set up your scene?
     
  13. Juliken

    Juliken

    Joined:
    Jan 30, 2017
    Posts:
    17
    I wanted to make a demo scene for our environment with a camera that travels the world. I used the cinemachine path to drive the camera movement. I had problems with the aim of the virtual camera to change the direction smoothly. When I tried to change the aim object with the code the transition was a simple cut. To avoid this problem I used multiple virtual camera each one aiming a different object in the scene. All the camera use the same path and I swap between camera using priorities. Every time I want a camera to be the main I change his priority.

    Maybe this is not the best way to achieve this but I didn't have a lot of time so I focused on a solution that I know.

    PS : It finaly works ! I changed all my priorities values to something bigger and it works. The hierarchy value is still the same I dont know what happend
     
  14. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,730
    Probably you had another vcam active somewhere with a higher priority than the original setting.
     
  15. aumsohoni

    aumsohoni

    Joined:
    Oct 22, 2021
    Posts:
    4
    I also have the same problem where I want to switch between 3 cams , I am setting the main cam's priority high then the second one's to lower than first one's priority and I want to switch it from second to the third cam after the priority is lower then the second cam but it is not switching to third cam
     
  16. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,730
    Could it be a layering issue? In order to be activated, vcams must be on layers that are included in the main camera's culling mask.