UI Elements in one canvas all moved - project not saving changes

Hi everyone,
using Unity ver 2022.3.4f1.

So I was working the whole day on my project as usual, so while in text play I opened my main menu and for some reason all the GameObjects are placed differently where they used to be.

I was NOT working on that canvas at all today, most of them are no prefabs, and I’m facing this problem the first time.

So I moved a few back to the correct position, saved and restarted Unity, and the GameObjects are back to the wrong position?

I can’t restart my PC right now, but does anyone know anything about this?

Also, does Unity make backups? To be honest, I don’t really want to rearrange all my GameObjects back to the proper positions again.

Thanks in advance

EDIT: Luckily I still had a manual backup, so I’m copying these values one by one now.
Apperaently the Pos Y has been changed to 0 at several GameObjects.
Even if I did by accident I don’t know how, because these are very nested GameObjects, but not all has been set to 0, so I don’t think I marked them accidentaly.

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

https://discussions.unity.com/t/845782/4

https://discussions.unity.com/t/848795/5

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.

https://gist.github.com/kurtdekker/8802b1b6c708637398f8c9167641efd3

PROPERLY CONFIGURING AND USING ENTERPRISE SOURCE CONTROL

I’m sorry you’ve had this issue. Please consider using proper industrial-grade enterprise-qualified source control in order to guard and protect your hard-earned work.

Personally I use git (completely outside of Unity) because it is free and there are tons of tutorials out there to help you set it up as well as free places to host your repo (BitBucket, Github, Gitlab, etc.).

You can also push git repositories to other drives: thumb drives, USB drives, network drives, etc., effectively putting a complete copy of the repository there.

As far as configuring Unity to play nice with git, keep this in mind:

https://discussions.unity.com/t/736093/3

I usually make a separate repository for each game, but I have some repositories with a bunch of smaller test games.

Here is how I use git in one of my games, Jetpack Kurt:

https://discussions.unity.com/t/807568/3

Using fine-grained source control as you work to refine your engineering:

https://discussions.unity.com/t/826718/2

Share/Sharing source code between projects:

https://discussions.unity.com/t/719810/2

Setting up an appropriate .gitignore file for Unity3D:

https://discussions.unity.com/t/834885/5

Generally the ONLY folders you should ever source control are:

Assets/
ProjectSettings/
Packages/

NEVER source control Library/ or Temp/ or Logs/
NEVER source control anything from Visual Studio (.vs, .csproj, none of that noise)

Setting git up with Unity (includes above .gitignore concepts):

It is only simple economics that you must expend as much effort into backing it up as you feel the work is worth in the first place. Digital storage is so unbelievably cheap today that you can buy gigabytes of flash drive storage for about the price of a cup of coffee. It’s simply ridiculous not to back up.

If you plan on joining the software industry, you will be required and expected to know how to use source control.

“Use source control or you will be really sad sooner or later.” - StarManta on the Unity3D forum boards

Always thankful for your answer
I’m always using a CanvasScaler 1920:1080 with “Match Width or Height” set to 0.5.

I was actually only doing scripting the whole day, and then at one test play it suddenly appeared that way.
Well nvm, I’m going to rearrange them all by copying the values from my backup.

Also thanks for the info for “backup”.
I’ll look into it if I find some time, but for now I’m good with doing manually backups time by time.

Hey there. Same happens to me in Unity 2022.3.4f
I did some work around and noticed, if after openening your project you see that your objects are not on the right places, just open another scene and then go back to the previous one, all will be fine. No need to revert positions manually.

1 Like