Search Issue Tracker
By Design
By Design in 3.1.X
Votes
1
Found in [Package]
3.1.4
Issue ID
CMCL-1722
Regression
No
Cinemachine2D bounds are not calculated properly when switching cameras position for the first time
Steps to reproduce:
1. Open the attached project “Promoted!.zip”
2. Open the “Demo“ scene
3. Enter Play mode
4. Walk with the character to another area (you can go to left side)
5. Observe the Game view when going through different areas
Expected result: Camera switches to another area
Actual result: Camera switches to unexpected position and switches to expected position in a split of a second
Reproducible with: 3.1.0(6000.3.0b4, 6000.4.0a1), 3.1.4(6000.0.58f1, 6000.2.7f1, 6000.3.0b4, 6000.4.0a1)
Could not test with: 3.0.1 (6000.3.0b4)(Project has too many errors)
Note: The strange behavior can only be seen going to another area for the first time after entering Play mode
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- "Shader warning in 'Hidden/Light2D': implicit truncation of vector type" is thrown when building Universal 2D template
- AI Assistant breaks compilation of packages using System.Runtime.CompilerServices.Unsafe via auto-referencing
- Unity Hub checks the "Documentation" module by default on the 6.4 and 6.5 streams despite that it was unchecked with the previous installs
- Shortcut that toggles between Dopesheet and Curves Views in the Animation Window's Timeline is mislabed
- Property List Items Overlap onto the Property List's top edge when scrolling through a long Property List
Resolution Note:
This is expected behaviour.
Confiners can take a few frames to warm up. When CinemachineCameras are activated using Priority and have StandbyUpdate set to RoundRobin, the warming up will occur in the background.
This project, however, enables and disables components to activate the camera. This is fine, but it will prevent the background warming up from occurring.
An easy workaround is to add the following script to the confined cameras (I added it to the CinemachineCamera prefab, and it solved the problem):
using Unity.Cinemachine;
using UnityEngine;
public class WarmUpConfiner : MonoBehaviour
{
private CinemachineConfiner2D m_Confiner;
private CinemachineVirtualCameraBase m_Vcam;
void OnEnable()
{
TryGetComponent(out m_Confiner);
TryGetComponent(out m_Vcam);
}
void Update()
{
if (m_Confiner != null && m_Vcam != null && !m_Confiner.BoundingShapeIsBaked)
m_Vcam.InternalUpdateCameraState(Vector3.up, 0);
else
enabled = false; // work done, go to sleep
}
}
Resolution Note (3.1.X):
This is expected behaviour.
Confiners can take a few frames to warm up. When CinemachineCameras are activated using Priority and have StandbyUpdate set to RoundRobin, the warming up will occur in the background.
This project, however, enables and disables components to activate the camera. This is fine, but it will prevent the background warming up from occurring.
An easy workaround is to add the following script to the confined cameras (I added it to the CinemachineCamera prefab, and it solved the problem):
using Unity.Cinemachine;
using UnityEngine;
public class WarmUpConfiner : MonoBehaviour
{
private CinemachineConfiner2D m_Confiner;
private CinemachineVirtualCameraBase m_Vcam;
void OnEnable()
{
TryGetComponent(out m_Confiner);
TryGetComponent(out m_Vcam);
}
void Update()
{
if (m_Confiner != null && m_Vcam != null && !m_Confiner.BoundingShapeIsBaked)
m_Vcam.InternalUpdateCameraState(Vector3.up, 0);
else
enabled = false; // work done, go to sleep
}
}