Multiplayer Canvas not showing on client?

While implementing Multiplayer into my game I’ve come across a problem. Originally each player was a camera with a canvas attached to it that allowed the player to do stuff but that did not work because of having multiple cameras active in a scene.

Now I’m attempting to have the players be the canvas attached to the camera and then externally attach it to the camera.

My problem is that the Host gets an overlaying canvas of both players while the joining client doesn’t get to see or control their own canvas.

I have a script that checks to see if !isLocalPlayer and then parents that canvas to another GameObject named Neutral while the other gets parented to the camera. Player 1 can still see both canvases while player 2 cant see their own canvas.

@geronimoj

Hello!

So if I understood it correctly, when you join the UI canvas is showing both 1 & 2 and player 2 can’t see any of them?

Use the !isLocalPlayer to check if player 1 is you and not any other player that is in the “room”. Then if it’s not you should disable the camera object and also the canvas, that creates this syncing system. It will only enable the localplayer camera. I used this everytime I began a multiplayer character, you can also use this technique to remove interfering with local scripts and other fun objects;

public GameObject camObj;


public void Start()
{

if(!isLocalPlayer)
{
camObj.SetActive(false);
}
else
{
camObj.SetActive(true);
}

}