Skip to content

Commit 371937f

Browse files
committed
fix(utils): use MainCamera singleton for viewport bounds utility
1 parent 3d2fc63 commit 371937f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

‎Assets/Scripts/Tools/Utils.cs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ public static Rect GetScreenRect(Vector3 screenPosition1, Vector3 screenPosition
6767

6868
public static Bounds GetViewportBounds(Camera camera, Vector3 screenPosition1, Vector3 screenPosition2)
6969
{
70-
var v1 = Camera.main.ScreenToViewportPoint(screenPosition1);
71-
var v2 = Camera.main.ScreenToViewportPoint(screenPosition2);
70+
var v1 = MainCamera.ScreenToViewportPoint(screenPosition1);
71+
var v2 = MainCamera.ScreenToViewportPoint(screenPosition2);
7272
var min = Vector3.Min(v1, v2);
7373
var max = Vector3.Max(v1, v2);
7474
min.z = camera.nearClipPlane;

0 commit comments

Comments
 (0)