Is it possible to link a UI element to a gameobject?

I have three images displayed in my game and my player needs to choose between them (it’s a character-selection type of thing). I’ve built UI buttons for each and they are positioned correctly to be used when testing in the editor, but because they are parented to the Canvas, they shift position and are out of place when I build the game.

I’ve tried moving the button to parent it to the same empty game object as the sprite in the scene itself, but then the button just disappears and can’t be seen at all in either the editor or the game (although it is in the hierarchy still).

Is there a way to force the link to the gameobject/sprites instead? Or is my only option to build a button without the built-in UI system, just with coding?

hi…i faced this problem.better to instantiate that UI object if you must want built in UI. otherwise just go with default unity scripting.and once take help from google.

Instantiate(canvas,new vector3 (0,0,0),quaternion.Identity);

hi create a canvas, inside it put 3 images of the 3 wizards and position all in the right position and pivot by the RectTransform component. then put as child of canvas the 3 buttons. add an event of the button, drag and drop the Game Object containing the function you need to execute inside the button event and select public void CreateWizard(). when the button is clicked the function is executed. do it for all the 3 buttons