- Home /
How do I stop assets from moving position after compile?
Hi,
I have simple scene with a single image in it - I set its Width and Height according to the image size and I set X and Y to 0 in an attempt to center the image.
My problem is twofold:
When I compile and run the scene, the image seems to have moved from where it was in the editor game preview.
I can't seem to center my image based on X resolution.
Could someone please point me into the right direction?
You need to build a responsive app, apps are not responsive by default
Could you please direct me to the right way to solve this. I just drag and drop all my objects to the scene. It's fine on my Game Scene, but upon building one of my object was misaligned.
If you said responsive, the browser screen size would vary but I'm not even moving the size of my browser.
Answer by unity_21erushbrook · Dec 09, 2020 at 11:19 AM
Sounds like its because of a resolution change.
The proper way to do this is to anchor the image to the center of the canvas (which should be set to screen space), and set the stretch mode to the corners of the screen. That way, the image will be the same size no matter the resolution of the monitor.
Hope this helps, Ethan.
If you need help doing this, look for a YouTube tutorial on Unity canvas scaling. That will surely help point you in the right direction and solve your issue.
Your answer
Follow this Question
Related Questions
transform.Translate doesnt travel the same distance for multi-reso 2 Answers
Best way to move elements around screen [uGUI] 0 Answers
Change resolution in runtime 0 Answers
iOS and Android Resolution limitation 0 Answers
1 Big texture, 2 materials? 2 Answers