I have 2 windows open on an app (split screen) which I have accomplished by changing the view port values of the camera to 0.5. I am trying to make it so the user can slide the windows up and down to one side bigger and as a result, the other smaller with the width always being the same.
I have attempted to do this by stretching out a scrollbar across the screen and changing the cam.rect value but it is a very ugly looking and while one panel gets smaller, the opposing panel does not get larger. Here is what I have so far
[SerializeField] private Camera cam;
[SerializeField] private Scrollbar slider;
Camera ARcam = GameObject.Find("ARCamera").GetComponent<Camera>();
float value = slider.value;
Debug.Log(value);
if (value < 0.1)
{
cam.rect = new Rect(0, 0.1f, 1, 0.9f); //x, y, width, height bot left is 0,0
ARcam.rect = new Rect(0, 0, 1, 0.1f);
}
else if(value > 0.8)
{
cam.rect = new Rect(0, 0.8f, 1, 0.2f); // top panel
ARcam.rect = new Rect(0, 0, 1, 0.8f); // bot panel
}
else
{
cam.rect = new Rect(0, value, 1, 1-value);
ARcam.rect = new Rect(0, 0, 1, value);
}
I am trying to have the slider between the screens to move them up and down
This is what I currently have