#UI acts weird on client
10 messages · Page 1 of 1 (latest)
Does the UI spawn when the player spawns? Like is the UI networked or is it like a normal single player game sorta speak
It’s part of the player prefab, so it spawns when the player does. They also have event systems parented under the prefab, not sure if that’s needed though?
@untold flare you should make the ui objects disabled and only enable them in onstartlocalplayer
hm that doesn't make any difference. Btw is there a difference between OnStartLocalPlayer and OnStartClient?
I might be getting somewhere. It looks like when I connect the second player, it's menu is visible to the host as well. and I guess they are competing for clicks. When the client disconnects the host's ui goes back to working correctly. So I guess I need to find a way to limit the visibility and functionality of the menu to the local player only. I am enabling it in onStartLocalPlayer, but the issue is I guess once it's enabled it is still affecting other players...
oh wait, I think I get it. I had another script to control which menu is visible, and even though I would use if (!islocalplayer) { return; } at the beginning of everything it was still turning stuff on for multiple clients. Moving all that logic into a script that's on the actual canvas and then letting the top level player script turn the canvas on in OnStartLocalPlayer seems to be working!
Is the canvas supposed to be in the game for everyone?
It would seem to me that you should remove the canvas from the player object and just have that be a local thing that spawns else you have a ton of canvases in the scene which I can't imagine would be good for performance.
Hm even if they are disabled? It’s like a pause menu / journal and will eventually have inventory type stuff maybe, so each player has different info that gets displayed