Certain scenes becomes modified just by opening them. Why? Extremely annoying [SOLVED]

I’m working on my first multi-scene project and just by switching between my scenes Unity is asking me whether or not I want to save my changes, but I haven’t made any changes! I’m using Unity 5.5.2f1 and this is not reproducible in a new project and this only happens for 3 of 7 scenes in my current project and I have no idea why.

Anyone have any insight to share on this? I’ve tried Googling, but I haven’t been able to find anything.

I guess I need to start removing stuff from the scenes until I can narrow it down to what causes it, but it would be awesome if someone knew from experience why this is happening and more importantly how to avoid it. :slight_smile:

Edit: This seems to be a bug with the Vertical Layout Group component in tandem with the Content Size Fitter Component. See my last reply.

1 Like

There is an option that shows what assets get saved. It shows up all the time for me and I was surprised at first as prior to putting that on I didn’t realize it was saving. Mostly the project file if anything at all was touched. Sometimes it was that line endings got changed somewhere and it needed saving in VS Studio Code and Unity.

Do you have code marked ExecuteInEditMode ?

I’m sorry, but I don’t understand your reply. What’s “the project file” in a Unity project? And this is inside the Unity Editor, Unity has no way of editing code files so line endings shouldn’t matter or get changed.

I did some quick testing and my canvas is present in all 3 affected scenes. If I disable the canvas game object then I can freely switch between the scenes without getting the prompt to save changes, but if the canvas is enabled then I get the prompt. I still haven’t figured out what causes it, but I can check to see if I have that property set anywhere. There is a quadrillion scripts in the canvas hierarchy.

1 Like

The VS project file. In Preferences i turned on Verify Saving Assets and it now shows me what it saves and it surprises me having worked with Unity so many years and that was going on without me knowing it was.

Ahh, right, didn’t know about that. I tried it and it only verifies that it’s saving the scene file which doesn’t help me much. :stuck_out_tongue:

It’s the Vertical Layout Group component. If you have prefabs as children of a Vertical Layout Group on which you’ve ticked either “Control Child Size” width or height the scene will be marked as changed every time you open it.

Someone else discovered it before me: Vertical Layout Group changing scene on load - Questions & Answers - Unity Discussions

But they apparently didn’t report it seeing as it’s still happening. So I did! My first bug report! I’m doing my part, are you?

Edit: Unity responded and I realized I gave them a poor repro-project. This also requires you to have a Content Size Fitter component on the parent game object as well.
Edit 2: Unity confirmed it was a bug and it’s going to be fixed.

5 Likes

I’m running 2018.1.0f2 and this is still an issue.

2 Likes

The same for me with Unity 2018.3.0f2
My Scene appears unsaved even by only switching from Unity to Visual Studio, then to Unity again.
I have to save it twice to get it unmarked.

1 Like

Any idea if this has been fixed?
Currently downloading 2018.3.2 simply because of this.

very annoying indeed.

I’ve seen modified scenes by just opening them quite frequently in 2018.3.2f1

One of the causes for this is float value imprecision. Here’s what a git diff looks like for a freshly opened scene that got modified:

@@ -5399,7 +5399,7 @@ RectTransform:
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_AnchorMin: {x: 0, y: 1}
   m_AnchorMax: {x: 1, y: 1}
-  m_AnchoredPosition: {x: 0, y: -0.000075450174}
+  m_AnchoredPosition: {x: 0, y: -0.00013032128}
   m_SizeDelta: {x: 0, y: 0}
   m_Pivot: {x: 0, y: 1}
--- !u!114 &192652846

A quick hack could be to round all floats before serializing rect transforms to some fraction of values, i.e. 0.001, ignoring the remainder. Been wanting to write an Editor extension for this for a while now.

1 Like

Still a bug on Unity 2019.1.0f2 !!!

3 Likes

Okay guys, did have the problem of scene that when your enter in it, it become dirty and must be saved.

I did browse my game objects by disabling them parent by parent, until I succeed to isolate the problem.

4535458--420274--Annotation 2019-05-13 134429.jpg

I did have in my UI canvas a Vertical layout, where one of the child did have the Aspect Ratio Fitter. There was actually a warning directly on the component to tell that it shouldn’t be there. (Undefined Results and conflicts)

Hope it helps!

2018.3.12f1 still has this bug. It is very critical in team work when you not sure is the changes were made by hands or because of bug. Waiting for fix!

1 Like

I am using 2018.4.12 and problem still there… Really annoying that makes me think everytime “Did I change something???”

Also a problem in 2017.4.32f. This is really interfering with teamwork and adding unnecessary verification steps to version control. Can’t coordinates just be rounded to some fraction, as spajus notes?

Looking at my last commit, rounding to 3 decimal places should fix it.

still there with 2019.3.0f6… why SOLVED marked ?

1 Like

I just tracked this down in my project by toggling UI gameobjects on and off and saving. That really helped narrow it down to this content size fitter that has a similar warning.