Skip to content

Commit

Permalink
fix: in rare cases, the particle size is incorrect with camera-space …
Browse files Browse the repository at this point in the history
…mode

close #93
  • Loading branch information
mob-sakai committed Sep 2, 2020
1 parent 878f812 commit 90593ac
Showing 1 changed file with 6 additions and 17 deletions.
23 changes: 6 additions & 17 deletions Packages/UIParticle/Scripts/BakingCamera.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,23 +82,12 @@ public static Camera GetCamera(Canvas canvas)

var camera = canvas.worldCamera;
var transform = Instance.transform;
if (canvas.renderMode != RenderMode.ScreenSpaceOverlay && camera)
{
var cameraTr = camera.transform;
transform.SetPositionAndRotation(cameraTr.position, cameraTr.rotation);

Instance._camera.orthographic = camera.orthographic;
Instance._camera.orthographicSize = camera.orthographicSize;
Instance._camera.fieldOfView = camera.fieldOfView;
Instance._camera.nearClipPlane = camera.nearClipPlane;
Instance._camera.farClipPlane = camera.farClipPlane;
Instance._camera.rect = camera.rect;
}
else
{
Instance._camera.orthographic = true;
transform.SetPositionAndRotation(canvas.transform.position + s_OrthoPosition, s_OrthoRotation);
}
var rotation = canvas.renderMode != RenderMode.ScreenSpaceOverlay && camera
? camera.transform.rotation
: s_OrthoRotation;

transform.SetPositionAndRotation(canvas.transform.position + s_OrthoPosition, rotation);
Instance._camera.orthographic = true;

return Instance._camera;
}
Expand Down

0 comments on commit 90593ac

Please sign in to comment.