How do I Programmatically save project with C#?

I’m trying to make a tool that will import assets the artist have created into unity. One of the key things I want to do is have Unity save project after it is checked out/added to Perforce and before it submits it so everyone can suck it down onto their own computer.

(Saving the scene will not work since we instantiate objects at runtime and have no objects in the actual scene. Thus we need to save prefabs in the project instead of the scene.)

EditorApplication.SaveAssets might be what you’re looking for. Maybe.

EditorApplication.ExecuteMenuItem(“File/Save Project”);