- Home /
Aligning sprite with Canvas
Hi guys, pretty new in unity and came across a problem.
I have a game where I wan't to change a sprite depending on a random number generated.. A dice.. I have succeeded in that, but I find my self fighting with the positioning of this dice.
It is supposed to just be a 2D dice directly on the GUI.
Now here to the question.
I can add an image to the canvas which is rather easy to align with the rest of the canvas using the anchors, but I can't figure out how to change the image programatically. I used a sprite instead, on which I can change the sprite, but not position it.
I have tried to struggle to make my canvas fit my camera size, but this seems to be impossible (the canvas is probably around 200x bigger than my game board).
I hope some of you can give me a solution, whether it is change the sprite of the Image programatically, or fixing the position of the sprite to the canvas.