I’m building a prototype that should be rendered in two different displays. The prototype have 3D elements and two canvas with RenderMode: Screen Space - Overlay, one will be rendered on Display 1, and the second one will be (if possible) rendered on first and second display:
-Canvas_1 → Display_1
-Canvas-2 → Display_1 + Display_2
The only way I see that I can get this working is duplicating the Canvas-2 and assign the original to Display_1 and the Clone to Display_2.
The problem with this approach is that every change made in one Canvas, won’t affect the other one, so I’ve to duplicate the behaviour (controllers etc) for every canvas Change.
I don’t know if this is the only approach, but it looks quite ugly to me right now, someone knows another one? Thanks!
Edit: Also I can’t use a RenderTexture approach cause the objective is to modify some other UI stuff depending on the Display and it will loose the interactivity.
I think the problem here is that canvas has to change size based on screen size, and there’s zero guarantee that display 1 and display 2 have the same size.
So you should probably use world space canvas and multiple cameras pointed at it instead.
But I think no, both displays render at the same resolution (1920x1080) so correct me if I’m wrong, but screen size are not a problem, isn’t it?
My second question is, if I use a world-space canvas I will have the same problems, I can only attach one camera to the canvas, and I’ll have to locate correctly that canvas, no?
((opinion)) The problem is that canvas has been designed to work with a single camera in overlay mode.
Placing it in the world space will solve this problem, and you’ll be able to see the canvas with any camera that is pointed at it, no matter how many cameras are there. https://docs.unity3d.com/Packages/com.unity.ugui@1.0/manual/UICanvas.html
However, you might still run into an issue with input handling (it is possible that canvas will receive clicks only from one camera, but it should be possible to work around that). Also a worldspace canvas will overlap with any 3d objects you have in the scene.
Basically, the easiest thing to do would be to use a separate canvas for each display, without syncing their elements (given that displays do not mirror each other but display different things, not duplicating canvas behaviors would make sense).
Hmmm I see your point @neginfinity .
As you said, the worldspace canvas can produce more issues (3D overlap, etc)
And yes, seems the easy way to duplicate Canvas objects for every Display, which is what I’m trying to avoid v.v cause canvas can behave the same and different , so I’ve to make an extra layer to manage every Canvas separately
Thanks again for your time, and hopefully will appear someone with a new brilliant idea! Until that happens I’m going to start splitting Canvas behaviours
Rather than duplicating it, make it into a prefab, and have it drive/control external objects. That way you’ll be able to have as many cameras as you want with this canvas configuration.
Another possibility is render texture, but that can be expensive.