From 119df9f267c741a8102bbf0e439bce0d812e302c Mon Sep 17 00:00:00 2001 From: HardlyDifficult Date: Fri, 1 Dec 2017 17:37:06 -0800 Subject: [PATCH] Configure for WebGL. Add AutoSave --- Assets/Scripts.meta | 10 ++++++++ Assets/Scripts/Editor.meta | 10 ++++++++ Assets/Scripts/Editor/AutoSave.cs | 35 ++++++++++++++++++++++++++ Assets/Scripts/Editor/AutoSave.cs.meta | 13 ++++++++++ ProjectSettings/GraphicsSettings.asset | 1 + ProjectSettings/ProjectSettings.asset | 2 +- 6 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 Assets/Scripts.meta create mode 100644 Assets/Scripts/Editor.meta create mode 100644 Assets/Scripts/Editor/AutoSave.cs create mode 100644 Assets/Scripts/Editor/AutoSave.cs.meta diff --git a/Assets/Scripts.meta b/Assets/Scripts.meta new file mode 100644 index 0000000..093e137 --- /dev/null +++ b/Assets/Scripts.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 16ed2216c3b6521488bdd364d382493a +folderAsset: yes +timeCreated: 1512178556 +licenseType: Pro +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Editor.meta b/Assets/Scripts/Editor.meta new file mode 100644 index 0000000..20b2ee9 --- /dev/null +++ b/Assets/Scripts/Editor.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: ae99c782d3a16b6439d1a22d8bc71de7 +folderAsset: yes +timeCreated: 1512178562 +licenseType: Pro +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Editor/AutoSave.cs b/Assets/Scripts/Editor/AutoSave.cs new file mode 100644 index 0000000..da1cbb9 --- /dev/null +++ b/Assets/Scripts/Editor/AutoSave.cs @@ -0,0 +1,35 @@ +using UnityEditor; +using UnityEditor.SceneManagement; + +/// +/// An editor script which automatically saves every time you +/// hit play. +/// +[InitializeOnLoad] +public class AutoSave +{ + #region Init + /// + /// Called before the game starts c/o InitializeOnLoad. + /// + static AutoSave() + { + EditorApplication.playmodeStateChanged + += OnPlaymodeStateChanged; + } + #endregion + + #region Events + /// + /// Called on enter/exit play mode and pause. + /// + static void OnPlaymodeStateChanged() + { + // Skip saving if in play mode, e.g. during pause + if (EditorApplication.isPlaying == false) + { + EditorSceneManager.SaveOpenScenes(); + } + } + #endregion +} \ No newline at end of file diff --git a/Assets/Scripts/Editor/AutoSave.cs.meta b/Assets/Scripts/Editor/AutoSave.cs.meta new file mode 100644 index 0000000..43789c3 --- /dev/null +++ b/Assets/Scripts/Editor/AutoSave.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 73cff03c7995a064dbe3317de5e2bc6c +timeCreated: 1512178570 +licenseType: Pro +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/ProjectSettings/GraphicsSettings.asset b/ProjectSettings/GraphicsSettings.asset index 74d7b53..d74737e 100644 --- a/ProjectSettings/GraphicsSettings.asset +++ b/ProjectSettings/GraphicsSettings.asset @@ -35,6 +35,7 @@ GraphicsSettings: - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0} - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} + - {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0} m_PreloadedShaders: [] m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index aa53bc6..9632ddb 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -66,7 +66,7 @@ PlayerSettings: defaultIsFullScreen: 1 defaultIsNativeResolution: 1 macRetinaSupport: 1 - runInBackground: 0 + runInBackground: 1 captureSingleScreen: 0 muteOtherAudioSources: 0 Prepare IOS For Recording: 0