33 PolygonCollider2D polygonCollider2D = GameObject.FindGameObjectWithTag(
Tags.
BoundsConfiner).GetComponent<PolygonCollider2D>();
35 CinemachineConfiner cinemachineConfiner = GetComponent<CinemachineConfiner>();
37 cinemachineConfiner.m_BoundingShape2D = polygonCollider2D;
40 cinemachineConfiner.InvalidatePathCache();
This class will confine the camera so that it won't go beyond the boundaries.
void OnDisable()
Unsubscribe from the AfterSceneLoadEvent event.
void SwitchBoundingShape()
Switch the collider that cinemachine uses to define the edges of the screen.
void OnEnable()
Subscribe to the AfterSceneLoadEvent event.