Unity keeps asking to save a scene

Every time I switch scenes int Unity, it will ask if I want to save the changes I’ve made to a scene, even though I didn’t make any. I noticed this started happening after I updated. Could it just be a bug or could there be another reason?

I know this is a little old, but this has been happening to me in 2018.2.0f2. I registered a callback with the Undo system to try to figure out what’s happening using the code below (in one of my editor classes). When I add this, I can see what undo-able changes are happening to the scene. In our case the issue is that Unity is making tiny changes to the anchor positions of the Handle game object for a scrollbar in our UI. It’s stuff like:

“Changed value for target Handle:m_AnchorMin.y to 0.0000004172325 from 0.0000011324883”

I haven’t figured out how to suppress tiny changes, but at least I’ve ruled out issues with our own code.

public static bool TrackSceneChanges = false;

public static void EnableSceneDirtyChecker() 
{
	if (!TrackSceneChanges)
	{
    	Undo.postprocessModifications += OnPostProcessModifications;
		TrackSceneChanges = true;
	}
}

public static void DisableSceneDirtyChecker()
{
	if (TrackSceneChanges)
	{
		Undo.postprocessModifications += OnPostProcessModifications;
	}
}

public static UndoPropertyModification[] OnPostProcessModifications(UndoPropertyModification[] propertyModifications) 
{
	Debug.Log("Dirty!");
	foreach (UndoPropertyModification mod in propertyModifications)
	{
		Debug.Log($"Changed value for target {mod.currentValue.target.name}:{mod.currentValue.propertyPath} to {mod.currentValue.value} from {mod.previousValue.value}");
	}

	return propertyModifications;
}

Layout->Revert Factory Settings->Restart Unity worked for me.

You are not only one facing this issue, so was I. I’m using various versions of Unity for various reasons, and this happens most versions.

This caused various reasons, but the main reason is that, in my case, internal UI data is updated(even I didn’t touch at all).

For example, here’s the actual data in the scene that already saved:

m_AnchoredPosition: {x: 611.11115, y: -160}

However, I didn’t do anything, just opened the scene(or after build the game), it suddenly changed like this:

m_AnchoredPosition: {x: 611, y: -160}

This is the main reason Unity keeps asking me to save the changes, even I didn’t touch anything at all. Seems like it’s related about the floating-point error but definitely should be fixed. This happens especially a lot when you are using anchor points and layout group components.

Another reason possibly could happen is that the external asset you imported in your project does something after loading the scene. For example, when you are using Google Play Games plugin for Unity, sometimes this module try to update some old file.

I don’t have a clear solution for this, hope Unity will fix this glitch because this glitch makes me careless when I add a commit to Git, when something changed scene, I just thought that “ah, that problem” and don’t check the changes. And actually this makes serious problems in my game, especially the game is already in service.

Hope Unity fixes this glitch.

Could be that some Editor scripts are changing your scene objects. Do you have your own- or Asset Store purchased Editor scripts in your project?

No, there isnt any bug with that. Lets say you havent changed anything, you think you havent changed anything, but Unity itself might have automaticly did tiny tiny changes that it needs to be saved. Dont worry, but we suggests that you keep saving it.

facing same problem. you got solution yet?

@caulfield85 @eddyspaghetti this bug (it is a bug!) happens on Unity 2018.1.5f1 as well. I guess that it has something to do with UI layout. For me the solution was to disable the child (with the layouts) in my root UI game object (I only use one UI canvas and have its children heavily nested). Something in that child is causing this issue I guess, I use layouts a lot inside it (it’s a menu). I’ll update my answer when I figure it out.