Draw GUI to different cameras.

Simply put, rather then doing a bunch of math, lets say I’m doing something like a 4 player split screen, and want to have different GUI information for each player, like in a racing game, it’d have the rank that the player is currently in. How would I do it to where I would effectively just attach a script to each camera and just go GUI.Label(blah blah) in the script once, just changing the variable for what player it’s watching.

I need to find a way to offset the position of the GUI element to where the camera is positioned. It’s not just needed for a 4 player split screen, but for a multitude of things. Is it possible to draw it to a second camera screen on the same screen as the primary screen?.. if all of that made sense.

I mostly use GUILayout. With that it is very simple to get what you just described, as long as the smaller area on the screen is not rotated. If you want it to be rotated, that one does not work.

Warning: Code is not tested

	// 'secondaryCamera' is the camera that does not fill the whole screen

Rect rectOnScreen = secondaryCamera.pixelRect;
GUILayout.BeginArea (rectOnScreen);

	// All the GUILayout calls will now affect that smaller area on the screen (GUI for 'secondaryCamera')

GUILayout.EndArea ();

Sort of what I needed. I needed GUI.BeginGroup which is the exact same thing, but just for GUI instead of GUILayout (to be honest, GUI is not that much harder then GUILayout is).

I very much prefer GUILayout. I don’t want to use absolute values, neither for positions nor for sizes. English is not my mother tongue. I know a lot of applications where the english version was probably amazing, but the german one was a shame, simply because the text did not fit into the gui elements. Sometimes help messages could not be read because the help windows are not resizable and the german text was longer. If I look at something like that I just think, oh my god, they must have spent a lot of time to get it right for one language with one font and for a specific screen resolution. IF one of them changes, it gets messed up. That’s why I try to avoid absolute stuff when it comes to GUI.
[End of a personal essay about gui :))