UI element attached to Camera Coordinates
Hey everyone,
I'd like to have a statistics panel (just a canvas with text basically) in the top right corner of the screen. I therefore attached a Canvas to the MainCamera, but thing is as you probably know all the rectransform fields are greyed out... Is there a way to give to the canvas a position relative to the center of the camera screen ?
Or maybe is there an entirely better way to do this ?
(Using Unity5.6.0)
Answer by Saryk360 · Apr 28, 2017 at 04:34 PM
Oh wait I got it, the Canvas is now in the "root" of the hierarchy, but set to "Screen Space - Camera"
Answer by ADAMN721 · Apr 28, 2017 at 04:14 PM
You shouldn't attach a canvas directly to a camera. This will cause you problems. Unless your game is networked, you can just add a canvas to the scene and it will be seen in front of the camera at all times. Then, just set your anchors for the UI components under the canvas for where you want them on the canvas IE, top right corner.
So I should have the canvas as "Screen Space - Overlay" and it'll always show on top of everything else ? Will it scale it down also, because if I do that the canvas is gigantic...
The canvas will look huge in the scene view but will be normal from the players perspective. Just leave the canvas on it's normal mode(I can't remember what that's called right now but the one above Screen Space - Overlay). Then just view it from your players perspective and set anchors.
It's not showing when I enter play mode... :/ What do you mean by "view it from the player's perspective ?"
Your answer
Follow this Question
Related Questions
UI Camera Question 2 Answers
My game screen is getting blue for 1 or 2 seconds when i am requesting and getting response ? 0 Answers
Retain Position and Scale Values of Render Texture Canvas Elements to another Canvas 0 Answers
UI Elements repositioning and resizing when playing game 1 Answer
Weird Rendering Unity5 1 Answer