@@ -25,12 +25,36 @@ public static void SaveEditorPrefs()
25
25
/// <summary>
26
26
/// Call this from a tests TearDown routine to restore editor preferences to the state it had before the test.
27
27
/// </summary>
28
+ /// <remarks>Note that if domain reloads have not been disabled and you have a domain reload mid-test,
29
+ /// this utility will fail to restore editor preferences since the saved data will be lost.</remarks>
28
30
public static void RestoreEditorPrefs ( )
29
31
{
30
32
EditorPrefs . SetBool ( EnterPlayModeOptionsEnabledKey , _savedEnterPlayModeOptionsEnabled ) ;
31
33
EditorPrefs . SetInt ( EnterPlayModeOptionsKey , _savedEnterPlayModeOptions ) ;
32
34
}
33
35
36
+ /// <summary>
37
+ /// Returns whether domain reloads are disabled.
38
+ /// </summary>
39
+ /// <returns>true if domain reloads have been disabled, else false.</returns>
40
+ public static bool IsDomainReloadsDisabled ( )
41
+ {
42
+ return EditorPrefs . GetBool ( EnterPlayModeOptionsEnabledKey , false ) &&
43
+ ( EditorPrefs . GetInt ( EnterPlayModeOptionsKey , ( int ) EnterPlayModeOptions . None ) &
44
+ ( int ) EnterPlayModeOptions . DisableDomainReload ) != 0 ;
45
+ }
46
+
47
+ /// <summary>
48
+ /// Returns whether scene reloads are disabled.
49
+ /// </summary>
50
+ /// <returns>true if scene reloads have been disabled, else false.</returns>
51
+ public static bool IsSceneReloadsDisabled ( )
52
+ {
53
+ return EditorPrefs . GetBool ( EnterPlayModeOptionsEnabledKey , false ) &&
54
+ ( EditorPrefs . GetInt ( EnterPlayModeOptionsKey , ( int ) EnterPlayModeOptions . None ) &
55
+ ( int ) EnterPlayModeOptions . DisableSceneReload ) != 0 ;
56
+ }
57
+
34
58
/// <summary>
35
59
/// Call this from within a test to temporarily enable domain reload.
36
60
/// </summary>
@@ -44,9 +68,9 @@ public static void EnableDomainReload()
44
68
/// </summary>
45
69
public static void DisableDomainReload ( )
46
70
{
47
- EditorPrefs . SetBool ( EnterPlayModeOptionsEnabledKey , true ) ;
48
71
EditorPrefs . SetInt ( EnterPlayModeOptionsKey , ( int ) ( EnterPlayModeOptions . DisableDomainReload |
49
72
EnterPlayModeOptions . DisableSceneReload ) ) ;
73
+ EditorPrefs . SetBool ( EnterPlayModeOptionsEnabledKey , true ) ;
50
74
}
51
75
}
52
76
}
0 commit comments