diff --git a/Editor/UI/Settings/AutopilotSettingsEditor.cs b/Editor/UI/Settings/AutopilotSettingsEditor.cs index 1d32be5..7e577d7 100644 --- a/Editor/UI/Settings/AutopilotSettingsEditor.cs +++ b/Editor/UI/Settings/AutopilotSettingsEditor.cs @@ -145,7 +145,9 @@ internal void Launch() else { state.launchFrom = LaunchType.EditMode; +#if UNITY_2020_3_OR_NEWER AssetDatabase.SaveAssetIfDirty(state); // Note: Sync with virtual players of MPPM package +#endif EditorApplication.isPlaying = true; } } diff --git a/Runtime/Launcher.cs b/Runtime/Launcher.cs index f55fcb2..8750e86 100644 --- a/Runtime/Launcher.cs +++ b/Runtime/Launcher.cs @@ -224,7 +224,7 @@ internal static async UniTaskVoid TeardownLaunchAutopilotAsync(AutopilotState st { state.settings = null; state.exitCode = exitCode; -#if UNITY_EDITOR +#if UNITY_EDITOR && UNITY_2020_3_OR_NEWER AssetDatabase.SaveAssetIfDirty(state); // Note: Sync with virtual players of MPPM package #endif diff --git a/Runtime/Settings/AutopilotSettings.cs b/Runtime/Settings/AutopilotSettings.cs index 385e358..af31ac9 100644 --- a/Runtime/Settings/AutopilotSettings.cs +++ b/Runtime/Settings/AutopilotSettings.cs @@ -323,7 +323,7 @@ private static void Initialize() settings.ConvertSceneCrossingAgentsFromObsoleteObserverAgent(logger); // Note: before convert other Agents. settings.ConvertErrorHandlerAgentFromObsoleteSettings(logger); -#if UNITY_EDITOR +#if UNITY_EDITOR && UNITY_2020_3_OR_NEWER AssetDatabase.SaveAssetIfDirty(settings); #endif } diff --git a/Runtime/Settings/AutopilotState.cs b/Runtime/Settings/AutopilotState.cs index 11e4d98..ed94e6c 100644 --- a/Runtime/Settings/AutopilotState.cs +++ b/Runtime/Settings/AutopilotState.cs @@ -46,7 +46,7 @@ public void Reset() launchFrom = LaunchType.NotSet; settings = null; exitCode = ExitCode.Normally; -#if UNITY_EDITOR +#if UNITY_EDITOR && UNITY_2020_3_OR_NEWER AssetDatabase.SaveAssetIfDirty(this); // Note: Sync with virtual players of MPPM package #endif }