- I modify a property via the scripting API.
- The scene is not made dirty.
Scripting APIs do not use the undo mechanism nor mark the scene dirty by default. One can, however, enforce these behaviors.
There are two different options for solving this:
If you have access to the object itself, you can use the Undo.RecordObject method before setting the property from the script.
Undo.RecordObject (myGameObject.transform, "Zero Transform Position"); myGameObject.transform.position = Vector3.zero;
An example that shows how the scene is marked dirty with Undo.RecordObject is attached at the end of this article.
One can also mark the scene as dirty manually using:
after setting a property from script for example:
LightmapEditorSettings.bakeResolution = 14; EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());