Search Issue Tracker

Won't Fix

Votes

1

Found in

5.4.0b18

Issue ID

801797

Regression

No

Scene is instantly marked dirty when opened if any object is affected by both a ContentSizeFitter and VerticalLayoutGroup

Scene/Game View

-

How to reproduce:
1. Open the attached project
2. Drag the two scenes into the Hierarchy "temp" and "temp2"
3. Select the green box and enable the ContentSizeFitter, so that it resizes itself vertically based its contents. ("Canvas" > "Example Prefab" > "GameObjWithProblem")
4. Hit Ctrl+S to save the scene
5. Right click on the "temp" scene again then click GameObject > Create Empty and save the scene
6. Hit Delete to destroy the created GameObject and save the scene again
7. Right click on the "temp" scene in the Hierarchy tab then click Unload Scene to unload it
8. Right click it again then click Load Scene to reload it.
9. Notice that the scene WAS instantly marked dirty! This will now happen every time the scene is reopened

Comments (15)

  1. cp-

    Oct 15, 2020 09:16

    @DrunkenMastah thanks for the pointer.

    I modified the class to my needs, just throw it into an Editor folder. It will log warnings when there is something dirtying the scene <1 second after saving it:
    https://gist.github.com/krisrok/eaa8b227b62e19555c5aefe86c5b6618

  2. Nodrap

    Aug 13, 2020 16:08

    Also caught by this 2019.4.5 and can't get the workaround working. I now cannot use a plugin that searches for references (AssetUsageDetector - a VERY useful tool) as it requires you to save the scene before it starts - and when you do it marks it dirty and so the tool thinks I haven't.
    I really hope Unity notices when a bug report is still getting comments that now are more than 2 pages. Surely a basic flag that users are not happy.

  3. chatrat12

    May 07, 2019 12:31

    Can we get the reasoning for the decision not fix this? Is the fix too complicated?

  4. DrunkenMastah

    Mar 04, 2019 00:02

    After searching the forums I came across this little post by
    arelian11 ยท Feb 05, 2015 at 10:29 PM

    https://answers.unity.com/questions/801464/get-dirty-state-from-a-scene.html

    Workaround Solution:
    Attach this to a game object in your scene and save the scene.
    Now every time you compile and if you scene is marked dirty it will be detected by this code and logged.
    Click on the logged line in console and it will point you the offending gameobject that is marking the scene dirty.
    Next, check the parent of the target game object of grandparent or so on...and if you see that it has a scroll rect, fix the floating values on the scroll rect to be rounded integers instead of floating values.

    This will fix the bug and the scene won't be marked dirty anymore.
    My scene had 30 or so objects that had this problem fixed it in 5 mins. No more version control bloat and more problems in sharing scene file.

    <code>
    public class SceneDirtyFlagChecker : MonoBehaviour
    {
    private static bool sceneIsDirty;

    static SceneDirtyFlagChecker()
    {
    Undo.postprocessModifications += OnPostProcessModifications;
    }

    private static UndoPropertyModification[] OnPostProcessModifications(UndoPropertyModification[] propertyModifications)
    {
    sceneIsDirty = true;
    Debug.LogWarning($"Scene was marked Dirty by number of objects = {propertyModifications.Length}");
    for (int i = 0; i < propertyModifications.Length; i++)
    {
    Debug.LogWarning($"currentValue.target = {propertyModifications[i].currentValue.target}", propertyModifications[i].currentValue.target);
    }
    return propertyModifications;
    }
    }
    </code>

  5. DrunkenMastah

    Mar 03, 2019 22:38

    2018.3.6f1 same issue. ScrollRect is causing it. Source control is bloated. Workflow is bad. How is this a Won't fix?

  6. Amazi

    Feb 19, 2019 23:37

    Why is this a Won't Fix? It's extremely frustrating and like others have questioned, is this behavior OK?

  7. RandomComm3nt

    Feb 10, 2019 09:10

    Also happening for me in 2018.3.0f2. As per BCook99's comment, this is annoying when using source control

  8. virgiliunov

    Jan 31, 2019 09:33

    This is happening in 2017.2 as well. WONTFIX? Lame!

  9. Forest3

    Jan 09, 2019 14:31

    A workaround for this is to identify the component that is making your scene dirty (in my case a ScrollRect), disable in the editor, and enable on Awake.

    private void Awake()
    {
    GetComponent<ScrollRect>().enabled = true; //disabled in editor as per unity bug
    }

    If anyone in Unity reads this, it would be good if you care about at least giving a workaround when you mark something as a "Won't Fix", consider the person that logged the issue spent time figuring our what was going, it was thanks to that person I found that my ScrollRect was the problem.

  10. sunyifeng

    Sep 14, 2018 03:07

    Same issue on 2018.2.3...

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.