- Home /
Clearing issue with multiple cameras and different viewports
I have two orthographic cameras setup for a vertical split screen. The main camera has a viewport covering the right 75% of the screen, and other camera's viewport covers the left 25% of the screen. The main/right camera is set to clear skybox, and the left camera is clear to solid color (although I've tried various combinations).
This all works fine in the editor. The right camera displays the game view, the left camera clears to the proper color and displays some constantly changing text.
The problem occurs when doing a build and running standalone. The left camera doesn't clear at all. It starts with some random view from the main camera and then just gets updated with the changing text until it's a blurry mess.
I'm running Unity 5.3.? (not sure the exact version and don't currently have it in front of me to check - I'll update when I can) on Windows 10 and doing a Windows build.
Has anyone else run into this kind of issue? I tend to assume it's something I'm doing wrong, but the difference in behavior between the editor and standalone makes me wonder.
I guess one other piece of info that might be relevant is that I start with the left camera disabled and the right camera's viewport at 100%. I then toggle it to the split screen setup. I need to try starting up with the split screen to see if that makes a difference, but haven't as of yet.
Not using deferred rendering, but do have a tone mapping image effect, so possibly relevant: https://issuetracker.unity3d.com/issues/camera-clearing-breaks-on-perspective-slash-deffered-slash-different-viewport-rect-settings
Answer by Dave-Carlile · Mar 24, 2016 at 11:28 PM
Found the issue. My game starts out with the left camera disabled and I enable it during the process of changing the viewports as outlined above. My mistake was that to disable the camera I was actually disabling the gameobject the camera lives on, but then using Camera.enabled to do my toggling - the gameobject always remained disabled.
It's interesting that it still worked in the editor but not standalone - seems like we should get the same behavior in the editor. Anyway, leaving the camera gameobject enabled resolved the issue.
And that, folks, is why you always first assume that you're at fault, because the odds strongly favor that being the case.
Your answer
Follow this Question
Related Questions
Outside game clear screen 0 Answers
How to properly set camera sizes in 2D Ortho camera split screen? 0 Answers
Clear gui Text field 1 Answer
Make a text visable only through an object 2 Answers
3d person controller split screen 2 Answers