Having UI follow player 2D C#
I'm currently trying to figure out how to make the UI canvas follow the player in game, so that the player can access the UI like a menu wherever they are. Sort of like how pressing 'Start' in the overworld in Pokemon or Mario opens up a menu, regardless of their position.
I haven't really done very much yet so I'm open to any ideas, but what I was currently thinking of doing was having the canvas be a child of a camera, which was a child of the player, and having the camera's position relative to the player be adjusted so the canvas is roughly centered around the player (is the canvas not supposed to center on the camera? The bottom-left corner of the canvas was the center of the camera). However, this created the issue that, when I would try to play the game, the camera that I would see through was the camera for the canvas, not the main camera. If someone can give me the script to change the active camera, that would be good too. Neither camera has any script, and no other objects reference them yet.
Also, I'm almost completely new to unity, so keeping things simple would be very appreciated. :D Though any help at all is appreciated as well.
Your answer
![](https://koobas.hobune.stream/wayback/20220612053910im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Moving moving Object with left/right arrow keys in a circular direction 3 Answers
Destroying 2D terrain at runtime 0 Answers
What is the most effective way to structure Card Effects in a Single Player game? 1 Answer
Randomize questions in a quiz game 2D 0 Answers
Trouble with directing launched projectiles in Unity 2D 0 Answers