Orthographic camera size not changing
Hello!
So I'd like to momentarily zoom the camera a little when the player clicks. What I've written runs through to the end and does debug the changed orthographic size when asked. However it seems that it is immediately reverted back to the starting value in the next frame. I have tried extending the WaitForSecondsRealtime to multiple seconds just to check that, to the same result.
Is there somewhere in unity that keeps the orthographic size constant and if so, can it be changed?
Many thanks in advance.
public IEnumerator CameraClickChange(float orthSize)
{
GetComponent<Camera>().orthographicSize = orthSize;
yield return new WaitForSecondsRealtime(.2f);
GetComponent<Camera>().orthographicSize = 5;
}
on another script
cameraScript.CameraClickChange(4.6f);
Your answer
Follow this Question
Related Questions
2D Camera boundaries C# 2 Answers
Orthographic Camera Appears to be Only Rendering Top Half of the Screen? 0 Answers
Giving The Illusion of Depth in an Orphographic Game 0 Answers
Persistent circle on Unity Orthographic Camera 0 Answers
Preventing world interactions when using an UI element with an Orthographic 3D camera 0 Answers