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

Bug Framing Transposer loses follow target as target group after any code compiling

Discussion in 'Cinemachine' started by Starcke, Dec 8, 2021.

  1. Starcke

    Starcke

    Joined:
    Feb 22, 2019
    Posts:
    5
    This bug consists in all the latest versions of cinemachine.
    I have a virtual camera with a follow target which has a Target Group component on it with 4 targets. It has no look at target.
    Its body is a Framing Transposer. When first set it registers the follow target as a target group and I have the fields at the end like Group Framing Mode etc.
    I have it set as Horizontal and vertical and Dolly only.
    When I then change any code and return to the editor for compiling. The framing transposer "forgets" that the follow target is a target group and it loses the fields at the end, and goes back to the regular camera distance which doesn't match with the target group targets.
    If I then select Framing Transposer as a body again, it sets it as a new Framing Transposer, but I can then press ctrl + z, and it reverts to the settings I actually had before the compiling.
    But it's not really a good solution as other people are working on the project too, and they need to see the correct camera view.
    Is there any way to force update the virtual camera to check the follow target, so I can put it into a script that executes in editor?
     
    Gregoryl likes this.
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,658
    This is indeed a regression in recent releases. Thank you for letting us know. We will fix it right away.

    In the meantime, a workaround is to add this code somewhere in your project:
    Code (CSharp):
    1. #if UNITY_EDITOR
    2.         [UnityEditor.InitializeOnLoad]
    3.         class OnDomainReload
    4.         {
    5.             static OnDomainReload()
    6.             {
    7.                 var vcams = FindObjectsOfType<CinemachineVirtualCameraBase>(true);
    8.                 foreach (var vcam in vcams)
    9.                 {
    10.                     var follow = vcam.Follow;
    11.                     var lookAt = vcam.LookAt;
    12.                     vcam.Follow = null;
    13.                     vcam.LookAt = null;
    14.                     vcam.InternalUpdateCameraState(Vector3.up, -1);
    15.                     vcam.Follow = follow;
    16.                     vcam.LookAt = lookAt;
    17.                 }
    18.             }
    19.         }
    20. #endif
    21.  
     
  3. Pogudesu

    Pogudesu

    Joined:
    Aug 3, 2019
    Posts:
    2
    Thanks for the code. But I haven't seen the fix of this bug with the recent update of Cinemachine. Version 2.6.17 - August 31, 2022. I'm using Unity 2020.3.25f1
     
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,658
    Can you try upgrading to CM 2.8.9?