Why do I "Save Project"?

This seems a really stupid question, but I really don't understand what is "saved" when I use "File -> Save Project". As I understand it, a project is a collection of assets, each of which is a file in the file system (and versioned in the Asset Server or an external VCS). So what is "saved" when I "Save Project" and why isn't that (whatever it is) just an asset like anything else?

(I understand Save Scene - that's saving the Hierarchy as a .unity asset in the project)

1 Answer

1

Your assumptions are correct. "Save Scene" saves the current hierarchy into .unity scenefile.

"Save Project" saves all unsaved modifications to any asset in your projectfolder to disk. This also automatically happens when you close Unity.

We don't automatically write any asset modification to disk immediately. We mark the asset as dirty, so that next time we save all assets, it will get saved.

And note that if you modify a prefab which is not instantiated in the current scene, you don't get the little * in the title bar -- but you still need to save the scene in order for the prefab change to be saved.

I would prefer a single Save item, and Auto-Save, or for Unity to never crash. You choose.

Agreed, a single save option would be better because when Unity crashes with unsaved assets it can cause major damage to a project!

For the curious, you can implement an AssetModificationProcessor, whose OnWillSaveAssets method will tell you which files are being saved when.

A perfect answer, thank you!