OpenCVForUnity
OpenCVForUnity copied to clipboard
problem make full screen in portrait mode
I have a problem that may be silly but it is affecting me. I want to set so that the camera occupies the entire screen on android.
I mean it's full screen in portrait mode. but I don't know how to do it if they could help me, I would appreciate it.
` private void SetFullScreen() { if (Application.isEditor && !IsAndroidTest) { aspectRadio = transform.localScale.x / transform.localScale.y; float sizeCam = (transform.localScale.x * aspectRadio / 2); Camera.main.orthographicSize = (transform.localScale.x * 0.5f / aspectRadio); ArScale = new Vector3(1 + aspectRadio, 1 + aspectRadio, 1 + aspectRadio / 2);
Debug.LogFormat("sizeCamera = {0}, aspectradio = {1}, myX = {2}, myY = {3}",sizeCam,aspectRadio, transform.localScale.x, transform.localScale.y);
}
else
{
transform.localScale = new Vector3(Screen.width, Screen.height, 1);
aspectRadio = Screen.height / Screen.width;
Camera.main.orthographicSize = transform.localScale.x * transform.localScale.y / transform.localScale.x * 0.5f;
ArScale = new Vector3(1, 1 + aspectRadio, 1);
}
}`
in the images you can notice what happens when placing full screen
