- Home /
UI with unity networking
Hi everybody ! I'm making an FPS but i have a problem with my UI : He doesn't follow the camera. I have a script that rotate with the camera that i use two time : one torotate X on the body and one to rotate y on the camera. When i rotate, the canvas stay at the same place. I tried Screen space - overlay, screen space - camera and world space. The canvas is a child of the camera :
Player
Graphics
Body
Camera
Weapon Canvas
Can someone halp me ? Thank you, bye, xyHeat
I don't know if this is your issue, but I don't usually see people childing their UI to the camera. Ins$$anonymous$$d, try making it a separate object and setting the canvas render mode to screen space overlay
I tried but this don't work, the UI don't follow the camera :/ i tried to change the culling mask with a new camera, only for the UI but it don't work too ... Now i'm trying screen space -camera changing the plane distance... It seem work
Answer by Chinmay_Gawande · Jun 03, 2018 at 07:29 PM
Hey @xyHeat , Can you please share how you have overcame the overlay of ui buttons of the two clients joining the same game ?
Hey, I fixed this a few time ago and I don't remember exactly how I did but try this :
Create an instance of your canvas with a script with access to each UI elements
Create a script that will setup all players components when it spawn (using if(!islocalplayer) statement)
Use this script to instantiate your canvas.
You'll have only one canvas because it is created only if you are the local player
I hope i helped you, have a good day :)
Thanks @xyHeat :) Really Appreciated That You Responded Can You Please Elaborate The 2. Point .
I usrd to create a script called SetupPlayer which contain a start method. This start method enable or disable components on player instance and instantiate things like canvas or other prefabs.
For this I use two public list of components : componentsToEnable and componentsToDisable. Then I loop through these lists with a for loop to enable or disable components.
To know what to do, I use unity networking features like islocalplayer which return true if the method is called on the active client You can find easily help about it on others posts
Answer by xyHeat · Jun 20, 2016 at 10:39 AM
I change my canvas to "screen space -camera" and i put the pkane distance to 0.4. It seem work.
Your answer

Follow this Question
Related Questions
Why when I make a Networking first person game it controls the other person? 1 Answer
Frames Per Second Cost from Multiplayer? 1 Answer
Network.sendRate = 50; is that bad? 0 Answers
MLAPI error with two instances of networked object 0 Answers
Multiplayer UI : What's the best implementation for a waypoint-like system? 0 Answers