@@ -7,6 +7,9 @@ static class Experimental
77 {
88 const string k_ExperimentalFeaturesEnabled = "PROBUILDER_EXPERIMENTAL_FEATURES" ;
99
10+ [ UserSetting ]
11+ static Pref < bool > s_experimentalFeatureEnabled = new Pref < bool > ( "experimental.enabled" , false , SettingsScope . Project ) ;
12+
1013 [ UserSetting ]
1114 static Pref < bool > s_MeshesAreAssets = new Pref < bool > ( "experimental.meshesAreAssets" , false , SettingsScope . Project ) ;
1215
@@ -24,25 +27,35 @@ internal static bool experimentalFeaturesEnabled
2427#endif
2528 }
2629
30+ static Experimental ( )
31+ {
32+ if ( s_experimentalFeatureEnabled . value != experimentalFeaturesEnabled )
33+ {
34+ s_experimentalFeatureEnabled . value = experimentalFeaturesEnabled ;
35+ ProBuilderSettings . Save ( ) ;
36+ }
37+ }
38+
39+ public static void AfterSettingsSaved ( )
40+ {
41+ #if PROBUILDER_EXPERIMENTAL_FEATURES
42+ if ( ! s_experimentalFeatureEnabled . value )
43+ ScriptingSymbolManager . RemoveScriptingDefine ( k_ExperimentalFeaturesEnabled ) ;
44+ #else
45+ if ( s_experimentalFeatureEnabled . value )
46+ ScriptingSymbolManager . AddScriptingDefine ( k_ExperimentalFeaturesEnabled ) ;
47+ #endif
48+ }
49+
2750 [ UserSettingBlock ( "Experimental" ) ]
2851 static void ExperimentalFeaturesSettings ( string searchContext )
2952 {
3053 var enabled = experimentalFeaturesEnabled ;
3154
32- EditorGUI . BeginChangeCheck ( ) ;
33-
3455 EditorGUILayout . HelpBox ( "Enabling Experimental Features will cause Unity to recompile scripts." , MessageType . Warning ) ;
35- enabled = SettingsGUILayout . SearchableToggle ( "Experimental Features Enabled" , enabled , searchContext ) ;
36-
37- if ( EditorGUI . EndChangeCheck ( ) )
38- {
39- if ( enabled )
40- ScriptingSymbolManager . AddScriptingDefine ( k_ExperimentalFeaturesEnabled ) ;
41- else
42- ScriptingSymbolManager . RemoveScriptingDefine ( k_ExperimentalFeaturesEnabled ) ;
43- }
56+ s_experimentalFeatureEnabled . value = SettingsGUILayout . SearchableToggle ( "Experimental Features Enabled" , enabled , searchContext ) ;
4457
45- if ( enabled )
58+ if ( s_experimentalFeatureEnabled . value )
4659 {
4760 using ( new SettingsGUILayout . IndentedGroup ( ) )
4861 {
0 commit comments