Buttons outside Canvas/UI

Hello,

So I have a 2D sidescrolling game that has a UI that follows the player (attached to the camera). This is all working fine. It is controlled by buttons on the canvas that the player can touch.

However, I wanted to add a merchant that the player can touch and subsequently bring up a Shop menu and pause the game. I can get this to work when the TradeButton is placed on the Canvas but the merchant is one in place and I don’t want this button on the canvas. The button however won’t register touches unless I move it inside the Canvas GameObject.

Is there any way to make the TradeButton not move relative to the canvas/player or to use a button outside of the canvas? I feel like I am missing something.

UI elements such as Buttons, Labels, Images, etc. MUST be inside a canvas or they will not work. You can make a second canvas to put your new button in. You can set a canvas to World Space if you do not want it to “follow the camera”.

7 Likes

Hey, that worked perfectly! Thanks so much, I really appreciate it.

1 Like