# Flipping the game so that the local player is always on the left side of the screen?

I'm making a 1v1 game with each player at one end of the screen. The game is an online client-server game. I would like the local player to be on the left side of their screen and their opponent (the remote player) on the right side. Similar to Clash Royale where the local player is always on the bottom and their enemy always on top.

What is the easiest way for me to accomplish this?

Some solutions I've thought of so far:

1. The server checks every time it sends data back to the players that if it's sending the data back to player 2, it flips it before sending it back. I don't particularly like this solution because it will greatly complicate the code, increasing the chances of bugs, and make it less flexible / re-usable in the future.
2. The client checks if it is player 2 and flips the data it received back from the server if it is. I don't like this solution for the same reasons as above.
3. Some camera tricks I don't know about.
• It might be helpful if you gave a short description or an image of your game to help illustrate your issue. – Tyyppi_77 Apr 1 '17 at 10:40
• Like in Clash Royale, the local player is always at the bottom of the screen and the player's opponent is always on top. I want to achieve the same thing but instead of top / bottom, left and right. – user94720 Apr 1 '17 at 10:54

I found out how to do it. I used this script from the wiki: http://wiki.unity3d.com/index.php?title=InvertCamerahttp://wiki.unity3d.com/index.php?title=InvertCamera

It's in JS and a bit outdated so here's a revised version:

using UnityEngine;

public sealed class CameraFlipper : MonoBehaviour
{
private void OnPreCull()
{
Camera.current.ResetWorldToCameraMatrix();
Camera.current.ResetProjectionMatrix();
Camera.current.projectionMatrix = Camera.current.projectionMatrix*Matrix4x4.Scale(new Vector3(-1, 1, 1));
}

private void OnPreRender()
{
GL.invertCulling = true;
}

private void OnPostRender()
{
GL.invertCulling = false;
}


Now, this will literally flip everything from left to right. Text will become illegible. To prevent certain objects from being flipped by the camera, put them all in a new layer (ie. "Text Layer") and on the flipped camera's culling mask, unselect "Text Layer". This will make the camera not render any object inside the "Text Layer" layer. To get the text to render properly, create a 2nd camera that is not flipped and set the culling mask to only "Text Layer".

Hope that makes sense.