Game Development Reference
In-Depth Information
EditorApplication.SaveAssets();
EditorApplication.SaveScene();
}
}
This method checks whether the editor is about to change the play state and is not being
played currently; if this is the case, then it saves the current changed assets and the current
scene.
Next, we hook up this function with the playmodeStateChanged event delegate in
the static constructor as follows:
static SaveSceneOnPlay()
{
EditorApplication.playmodeStateChanged +=
SaveSceneIfPlaying;
}
Now, with this script in our project, whenever we hit play, the script will automatically
save the project for us.
Search WWH ::




Custom Search