Spelunx Cavern SDK
 
Loading...
Searching...
No Matches
AutoActivateFullscreenPreview.cs
Go to the documentation of this file.
1using UnityEditor;
2
4{
5 [InitializeOnLoad]
7 {
8 public const string IsFullscreenPreviewEnabledKey = "Fullscreen On Play";
9
11 {
12 EditorApplication.playModeStateChanged += OnPlayModeStateChanged;
13 }
14
15 private static void OnPlayModeStateChanged(PlayModeStateChange state)
16 {
17 if (EditorPrefs.GetBool(IsFullscreenPreviewEnabledKey, false))
18 {
19 if (state == PlayModeStateChange.EnteredPlayMode)
20 {
21 FullscreenGameView.SetFullscreen(true);
22 }
23 if (state == PlayModeStateChange.ExitingPlayMode)
24 {
25 FullscreenGameView.SetFullscreen(false);
26 }
27 }
28 }
29 }
30}