Target group composer with dolly has a weird issue

Hello!
I’ve encountered a super weird issue in TargetGroup + GroupComposer Virtual Camera.
When I set the AdjustmentMode of GroupComposer to “Dolly Only” or “Dolly then Zoom”, the camera is trying to put itself to the same place of target group. Most important, the issue happens only “sometimes”. It sometimes works properly (like normal dolly), but sometimes the bug appeared, with exact same steps.
Moreover, even in the normally-working condition, if I shutdown the unity editor and re-open (without any scene or project changes), sometimes the bug reappears.

I’ve took a video of the simplest steps to reproduce the bug. (but even with the same steps, it sometimes works)

I’m using m1-pro mac book pro, Unity version 2021.3.8 or 2022.1.0, and Cinemachine version 2.8.9.
(And by the way, I haven’t encountered this bug in my Windows computer, but I’m not sure if it is an OS / CPU chip issue)

Is this a known bug?
Thanks ahead for your reply.

It’s not a known bug. Can you send me your small repro project?

Thank you for the fast reply!
The attached file is the reproducing project. If a bug report is better, I can make a bug report.

8490251–1129508–CinemacineTargetGroupDollyIssue.zip (2.68 MB)

Thanks for the upload, but I cannot repro the problem. It’s unlikely to be processor-related, in my opinion. I will keep trying from time to time.

1 Like

I still can’t repro this. If you get any more information that might help, please send it.

1 Like

Hello!
Thanks for your continuous testing.

I have some more information to share, but I think this problem may only happen on my mac / specific computers (due to its weird behavior), so maybe the dev team can lower the priority of this issue, or even ignore it.
Also I forgot to say that I’m using m1 pro mac, but Intel edition of Unity Editor instead of Silicon, due to a bug that Silicon Unity Editor can’t load some native dll.
edit: I’ve found another person reported the same bug (Issue UUM-10178), and it has the same environment(m1 mac, but Intel Unity Editor).

For other who may encounter the same problem, a quick solution is to turn the debug mode on (the bug icon in the right bottom of Unity), and it will start behave properly.

8523881--1137041--debug-mode-on.png


So, to find out the reason, I put the Package Cache of Cinemachine 2.8.9 into Assets folder (in order to add Debug.Log()) and Log the calculations to see where the problem is. The problem seems to be at line-217 of CinemachineGroupComposer.cs, which is calculating the targetDistance local variable for further calculation.
Here comes the weird part. Whenever I Log the targetDistance value to the Console, it immediately behaves normally, like normal dolly, but if I deleted the log line, the issue again appears. (I didn’t change any logic! just logging)

Next, I tried to indirectly get the value of targetDistance by logging the results of the relative calculation, not targetDistance itself.
(sorry for the messy codes)

and it gives me the following log output:

the second line shows “-10 = targetDistance - 10”, which means targetDistance is 0,
but that is literally impossible, because in any condition, targetDistance should be clamped to min value 1.5, due to the first line.

It is like if I don’t check the value of targetDistance, C# won’t calculate targetDistance at all, and leave it to default value 0.

Since the issue is beyond coding, I think there is no short way to fix this.
Turning on the debug mode lets C# “inspect” the value of any local variable for breakpoint-debugging, making the variable be calculated, and hence start working properly.

@Gregoryl just a bump in case the notification wasn’t sent :slight_smile:
I’ve wrote my test result (and temporary solution) in the above reply, please check when you have time.
Brief answer: I think it only occurs on “m1 mac + Intel (not Silicon) Unity editor”
Solution: turn on the C# script debugging mode

Thanks for the update. It does indeed look like a mac-only c# thing. Since I don’t have a mac, I can’t dig into this or find a workaround. Because this issue was reported elsewhere, the appropriate teams will be looking into it - assuming it’s the same issue. As you have a reliable repro, you might want to also log an issue.

1 Like