A Unity ID allows you to buy and/or subscribe to Unity products and services, shop in the Asset Store and participate
in the Unity community.
Discussion in 'Cinemachine' started by laxhen, Jul 21, 2019.
I want to create a Pause screen, while still using Cinemachine
If you set Time.timescale to 0 that should do it
Sorry to revive this, I'm in a similar situation with bringing up my JRPG menu while transitioning between two Virtual Cameras.
There are plenty of reasons to keep TimeScale at 1 for a pause menu, I do all my UI Tweens programmatically for instance, not to mention a lot of pause menus show your play time increase in real time.
Needless to say, TimeScale = 0 is a bit of a hacky way to implement a pause screen, are there any other solutions?
Currently when I set enabled = false; on the camera it pauses for the menu, but when I re-enabled it after the menu closes it jumps to the end of the blend, which I imagine is tied to Time.time.
I've tried to grab the Brain's ActiveBlend and try to restore it when my menu closes, but it doesn't work still.
If there's no current solution in Cinemachine, I might make a patched version of CinemachineBlend that has an exposed Pause()/Resume().
Might be better to implement a timescale override on the brain, replacing the current IgnoreTimescale checkbox.
So originally I wanted to just make a wrapper, but not enough variables were accessible from the base code to have any impact.
Here's my workaround for anyone who faces the same problem.
When I bring up my menu mid transition,
1: Disable the active camera on the brain, store said camera
2: Have a PauseMenuCamera copy the main camera's transform and enable it.
3: In code find out the remaining time from Brain.ActiveBlend, Duration - TimeSpent
4: Set the custom blend from PauseMenuCamera -> **ANY CAMERA** to the remaining time via Brain.CustomBlends (They're a struct, so you'll have to pull it, edit it, and send it back in).
5: When you unpause, disable PauseMenuCamera, enable the previous camera.
6: Watch it finish the transition.