Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Virtual Camera Status Still "Live" when the component disable

Discussion in 'Cinemachine' started by LuXuan444, Mar 28, 2018.

  1. LuXuan444

    LuXuan444

    Joined:
    Jan 18, 2013
    Posts:
    19
    Hi :D

    I'm using "Cinemachine Version 2.1.10" in "Unity 2017.3.1f1", and I encounter some weird bugs in my 2D project?

    1. Virtual Camera Status Still "Live" when the component disable.


    2. Virtual Camera "Lens" settings lost when stop playing.
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,658
    The "stays live" thing could be just a UI refresh problem in the inspector. Does it have an impact in your game?

    The Lens FOV/orthoSize always follows the Unity Camera attached to the brain. If the inspector is switching when the game stops, it's because the Unity Camera is changing to perspective. The setting, however, is not lost.
     
  3. LuXuan444

    LuXuan444

    Joined:
    Jan 18, 2013
    Posts:
    19
    The status stay live did affect game not just UI, the virtual camera still working and following the Follow target.

    The second problem seems like I'm using wrong word, sorry for my terrible English : /
    The Unity Camera attached to the brain is not changing to perspective after game stops, weird
     
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,658
    Do you have CinemachineTracks inside a timeline? If you active a vcam from a timeline it will go live, even if disabled.

    Do you have a second CinemachineBrain in your scene somewhere? That could be causing the perspective thing. If so, delete it.
     
  5. LuXuan444

    LuXuan444

    Joined:
    Jan 18, 2013
    Posts:
    19
    Nope, I didn't use any of timeline's feature yet, I currently only use script to control Virtual Camera, and I only control virtual camera by switching enable of component.

    In the video's scene there is only one CinemachineBrain in Main Camera.

    My Virtual Camera setup is like this:
    1. VCam - Follow Player (Priority = 10)
    2. VCam - Current Spawn Point (Priority = 9)
    3. VCam - Do Nothing (Priority = 0)
    When the player die, VCam-FollowPlayer & CurrentSpawnPoint will disable, only VCam-DoNothing is enable.
    However, the VCam-FollowPlayer still live, so there is two live's virtual cameras, and I check the LiveBlend in CinemachineBrain, it shows "[Vcam - Do Nothing] --% from [VCam - Follow Player]".

    Sometime it works fine, VCam-FollowPlayer's status is Disabled and VCam-DoNothing's status is Live.
    LiveBlend shows "[Vcam - Do Nothing] --% from [Mid-blend]".
     
  6. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,658
    Aaahhh! I think I understand now.

    It's frozen mid-blend. When you disable a vcam and blending is enabled, the vcam won't disappear right away - it is artificially kept on "life-support" until the blend has finished. I think you are getting into a situation where you have set the time scale to 0, so the blend just stops advancing because the game clock has stopped. There is a setting on the brain that will allow the blends to ignore the time scale. Enable this checkbox:

    upload_2018-4-3_9-47-10.png
     
  7. LuXuan444

    LuXuan444

    Joined:
    Jan 18, 2013
    Posts:
    19
    After a few tests, I figured out something:

    I didn't set the time scale to 0 after player die, but I move the player to a very far distance like "Vector2(999f, 999f)".
    So when the camera blend is too long (e.g. 2 sec), player will be moved to far distance while blending, the Follow Player camera will jump to player position, and the blending will suddenly jump a little bit.
    If the blend is complete before player be moved to far distance, it won't have any problem.

    It's possible to control the blend so I can blend the Vcam - Do Nothing from Mid-blend instead of VCam - Follow Player?
    Or I just stop follow player by removing the player from Virtual Camera Follow field when player dead, I think it could do the trick.
     
    Last edited: Apr 4, 2018
  8. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,658
    Yes, just removing the player from the Follow target is probably the best thing to do. Also set the LookAt target to null. With empty targets the Follow vcam will just stay where it is and the blend will be nice.
     
  9. LuXuan444

    LuXuan444

    Joined:
    Jan 18, 2013
    Posts:
    19
    hmm.... but the second question about the camera changing to perspective after stop playing still exist.
    I'm not sure why this happened. Sometime it doesn't change to perspective and works fine.
     
  10. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,658
    The only reason I can think of why it might change to Perspective is that you have another Unity camera somewhere in your scene, set to Perspective, with a Brain on it. Can you search your scene for Cameras?
     
  11. LuXuan444

    LuXuan444

    Joined:
    Jan 18, 2013
    Posts:
    19
    These are the only two cameras in the scene

    Main Camera:



    UI Camera:
     
  12. LuXuan444

    LuXuan444

    Joined:
    Jan 18, 2013
    Posts:
    19
    I tested this project on another computer, and have the same result.

    How about I send this project file to you, so you can find out what's going on?
     
  13. DJDaka

    DJDaka

    Joined:
    Jul 31, 2018
    Posts:
    1
    And he never returned...
     
  14. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,658
    @LuLuKo are you still having this problem?
     
    lehtimakijyri likes this.