positions keep resetting incorrectly

I opened a project in a newer Unity version after buying a new pc but a few UI game objects had incorrect positions. I corrected them, but, every time I save the project, close it, and reopen it, they go back to incorrect positions. Also, If after opening i go from one scene to another scene and back to the original they’re suddenly correct again. But when I publish the project and test on my phone they’re incorrect.

what is happening? how do i fix this?

What positions on what items? UI items?

Here are some notes on UI Anchoring, Scaling, CanvasScaler, etc:

Usually you need to choose a suitable ScaleMode and MatchMode in the Canvas Scaler and stick with it 100%. Generally if you change those settings you will often need to redo your UI entirely.

I also use this CanvasScalerOrientationDriver utility to make sharing UI for Landscape / Portrait easier. Read what it does carefully.

Otherwise…

How to report your problem productively in the Unity3D forums:

http://plbm.com/?p=220

This is the bare minimum of information to report:

  • what you want
  • what you tried
  • what you expected to happen
  • what actually happened, log output, variable values, and especially any errors you see
  • links to documentation you used to cross-check your work (CRITICAL!!!)

it’s not a matter of finetuning or anchoring. For example, some button in my original project on old pc was placed at X,Y 150, 150. For some reason on my new pc in new unity version it opens the same project with button on X,Y 0, 35. When I place it back to 150, 150 and save the project, close it, reopen it, it’s back at X,Y 0, 35.

When i open another scene and then open the first scene again… it IS correctly at 150, 150 but if i publish it and try on phone it is at 0, 35

It only happens with about 4 or 5 buttons but I still need to fix them.

What you describe is exactly what happens when there IS an anchoring / scaling problem.

What leads you to conclude that your project is different?

Great, get started on the anchoring and scaling notes above.

Hint: that’s how you fix this stuff.

It isn’t
I actually narrowed down the problem. Above i gave example positions but the positions were just to give an example. It’s actually ONLY the Y value which resets.

Plus I tried something else

  • i created a new canvas with anchoring as described in first link you gave (my ui’s already have the same anyway)
  • i created a new image
  • i anchored it left top
  • i place it at XY 33,33
  • save the scene, save the project
  • close it, reopen it
  • image is at position XY 33,0

Followup → if i create an extra blank GameObject next to the image and anchor it left top, and then place the image in that gameobject, save project, close, and reopen, the image DOES reopen at 33,33

it really feels like a bug.

Which Unity version are you using? There was a problem with UI in v2022.3.* that’s fixed in v2022.3.5, so try that version

v2022.3.4f1

Yes, that’s the buggy one

now my dilemma, either place a container gameobject around/above my buttons and fix it that way or install new version and risk jdk gradle trouble again like I had trying to get my project working from old to new pc.

oh god. I 2022.3.4f1 is full of bug. And I chose to start my project in this version… fuck me.