Search Unity

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

Discussion in 'Editor & General Support' started by TwiiK, Apr 24, 2017.

  1. TwiiK

    TwiiK

    Joined:
    Oct 23, 2007
    Posts:
    1,729
    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. :)

    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.
     
    Last edited: Apr 30, 2017
    Ali_V_Quest likes this.
  2. ippdev

    ippdev

    Joined:
    Feb 7, 2010
    Posts:
    3,853
    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.
     
  3. JustAnotherDude

    JustAnotherDude

    Joined:
    Oct 28, 2013
    Posts:
    279
    Do you have code marked ExecuteInEditMode ?
     
  4. TwiiK

    TwiiK

    Joined:
    Oct 23, 2007
    Posts:
    1,729
    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.
     
  5. ippdev

    ippdev

    Joined:
    Feb 7, 2010
    Posts:
    3,853
    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.
     
  6. TwiiK

    TwiiK

    Joined:
    Oct 23, 2007
    Posts:
    1,729
    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. :p
     
  7. TwiiK

    TwiiK

    Joined:
    Oct 23, 2007
    Posts:
    1,729
    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: http://answers.unity3d.com/questions/940873/vertical-layout-group-changing-scene-on-load.html

    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.
     
    Last edited: Apr 30, 2017
  8. INSANE_BR

    INSANE_BR

    Joined:
    Sep 10, 2009
    Posts:
    142
    I'm running 2018.1.0f2 and this is still an issue.
     
    Ali_V_Quest and spacehelmetboy like this.
  9. Koyemsi

    Koyemsi

    Joined:
    Sep 25, 2017
    Posts:
    29
    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.
     
    spacehelmetboy likes this.
  10. aklgupta

    aklgupta

    Joined:
    Jun 9, 2014
    Posts:
    29
    Any idea if this has been fixed?
    Currently downloading 2018.3.2 simply because of this.
     
  11. momoguru

    momoguru

    Joined:
    Mar 9, 2014
    Posts:
    11
    very annoying indeed.
     
  12. MNNoxMortem

    MNNoxMortem

    Joined:
    Sep 11, 2016
    Posts:
    723
    I've seen modified scenes by just opening them quite frequently in 2018.3.2f1
     
  13. spajus

    spajus

    Joined:
    Jun 10, 2015
    Posts:
    47
    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:

    Code (csharp):
    1.  
    2. @@ -5399,7 +5399,7 @@ RectTransform:
    3.    m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
    4.    m_AnchorMin: {x: 0, y: 1}
    5.    m_AnchorMax: {x: 1, y: 1}
    6. -  m_AnchoredPosition: {x: 0, y: -0.000075450174}
    7. +  m_AnchoredPosition: {x: 0, y: -0.00013032128}
    8.    m_SizeDelta: {x: 0, y: 0}
    9.    m_Pivot: {x: 0, y: 1}
    10. --- !u!114 &192652846
    11.  
    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.
     
    mandy_ichigo likes this.
  14. Yumby

    Yumby

    Joined:
    Aug 17, 2012
    Posts:
    20
    Still a bug on Unity 2019.1.0f2 !!!!
     
    DaneGillburry, DrummerB and Rafarel like this.
  15. Strateolab_team

    Strateolab_team

    Joined:
    Feb 16, 2018
    Posts:
    8
    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.

    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!
     
    Last edited: Jun 20, 2019
  16. komarov_unity

    komarov_unity

    Joined:
    Apr 19, 2019
    Posts:
    1
    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!
     
    neliuz likes this.
  17. Gokcan

    Gokcan

    Joined:
    Aug 15, 2013
    Posts:
    289
    I am using 2018.4.12 and problem still there... Really annoying that makes me think everytime "Did I change something???"
     
  18. Coredumping

    Coredumping

    Joined:
    Dec 17, 2014
    Posts:
    51
    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.
     
    Last edited: Dec 22, 2019
  19. jtachikawa

    jtachikawa

    Joined:
    Dec 9, 2019
    Posts:
    2
    still there with 2019.3.0f6... why SOLVED marked ?
     
    MNNoxMortem likes this.
  20. Bryan-Legend

    Bryan-Legend

    Joined:
    Sep 8, 2012
    Posts:
    80
    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.

    upload_2020-3-4_15-3-21.png
     
  21. Hazneliel

    Hazneliel

    Joined:
    Nov 14, 2013
    Posts:
    305
    Still having this issue on Unity 2019.3.10f1
     
  22. srpnt3

    srpnt3

    Joined:
    Feb 8, 2020
    Posts:
    1
  23. Muuurphy

    Muuurphy

    Joined:
    Sep 22, 2013
    Posts:
    4
    This is still a problem (Unity 2019.3.13f1) and it happens even if there are no prefabs involved (as other people point as the source of the problem) and only if you are using the built in UI scripts (content size fitter, horizontal/vertical layout groups, etc). It is just a bug in Unity that needs to be solved.
     
  24. spajus

    spajus

    Joined:
    Jun 10, 2015
    Posts:
    47
  25. TCROC

    TCROC

    Joined:
    Aug 15, 2015
    Posts:
    230
    Has this bug been reported and / or is it being tracked anywhere?
     
  26. Koyemsi

    Koyemsi

    Joined:
    Sep 25, 2017
    Posts:
    29
    Same problem going on for me with Unity 2019.4.13f1. The scene appears unsaved when launching Unity, and sometimes also when leaving play mode.
    Had the idea to check in the Edit menu what was the last "undo" action, and it's labeled "Undo Driving Recttransform". If I undo it, my Scene is no more marked as unsaved.
     
  27. FireHawkX

    FireHawkX

    Joined:
    Apr 26, 2016
    Posts:
    28
    We are now in 2022 (hello from the future)... I am using a somewhat recent Unity 2021.2.11f1 and getting this ridiculous issue...

    I have a Huge Menu UI prefab... that prefab has 1 content fitter, and many horizontal and vertical layout group in its many childs...

    Whenever I open up that prefab, i get the * has been modified, and upon closing the would you like to save it... even when no changes has been made...

    I understand that floating point error thingy... but someone wrote in this thread from 2017 that there was a bug in unity and they answered they were going to fix it!!! REALLY?? :)
     
    verny2verny likes this.
  28. ExplosiveBarrels

    ExplosiveBarrels

    Joined:
    Oct 18, 2016
    Posts:
    11
    It's 2024, and this is still an issue in 2021.3.31f
    I guess Unity will never bother fixing it
     
  29. tsibiski

    tsibiski

    Joined:
    Jul 11, 2016
    Posts:
    604
    I am considering switching to GODOT for my next game because of this issue alone. It is a way bigger issue than it seems at first glance.
     
  30. krougeau

    krougeau

    Joined:
    Jul 1, 2012
    Posts:
    456
    Greetings from even further in the future. This issue persists in Unity 2022.3.24 as well & doesn't seem to be GUI specific as it's happening to me in a scene that does not have any GUI components (two empty game objects with a script on each & a directional light, that's it). I've checked the three gameobjects in the scene & see no floating point's anywhere (everything is anchored at 0,0,0 & I'm seeing no changes). I'm by no means expecting a solution; if it mattered to Unity, they'd have fixed it after these many, many years.
     
    Last edited: Apr 16, 2024