Match Canvas with Main Camera - Unity

Fabrizio Demaria picture Fabrizio Demaria · Oct 12, 2015 · Viewed 28.9k times · Source

I want to use the Canvas and UI Text to constantly show the score of my game on the top right corner of the screen. How can I initialize the Canvas so that its position and dimensions perfectly match the border of the camera? (2D Setup)

Answer

user3071284 picture user3071284 · Oct 12, 2015

To see the canvas fit into the camera's size in the scene, change the Canvas component's Render Mode to Screen Space - Camera, and drag the camera from the hierarchy to it.