public void OnInitialize() { CurState = Preferences.Get(c_statePrefKey, State.Disabled); UpdateDebugDrawStateSymbols(); IsVisibleAtStart = ScriptingDefines.ContainsSymbol(c_visibleDefineSymbol); }
public static void Disable() { if (ScriptingDefines.Remove(Define, AssertationsDefine)) { if (InspectorUtility.ActiveManager != null && InspectorUtility.ActiveManager.SelectedInspector != null) { InspectorUtility.ActiveManager.SelectedInspector.Message("Disabing Development Mode...", null, MessageType.Info, false); //UnityEngine.Debug.Log("Removed "+Define+" and "+AssertationsDefine+" from Scripting Define Symbols in Player Settings."); } } }
private void UpdateDefineSymbols() { if (m_isEnabled == false) { ScriptingDefines.AddSymbol(c_disabledDefineSymbol); } else { ScriptingDefines.RemoveSymbol(c_disabledDefineSymbol); } }
public void OnGUI() { EditorGUI.BeginChangeCheck(); GUIContent debugDrawContent = new GUIContent("State", "Determines whether the Debug Draw feature is compiled away or not"); int state = EditorGUILayout.Popup(debugDrawContent, ( int )CurState, s_stateOptions); if (EditorGUI.EndChangeCheck()) { CurState = ( State )state; UpdateDebugDrawStateSymbols(); Preferences.Set(c_statePrefKey, CurState); } using (new EditorGUI.DisabledScope(CurState == State.Disabled)) { if (!Application.isPlaying) { GUIContent defaultContent = new GUIContent("Visible at start", "Sets whether drawing is initially visible or not (can be toggled on/off through code later)"); EditorGUI.BeginChangeCheck(); bool isVisibleAtStart = EditorGUILayout.Toggle(defaultContent, IsVisibleAtStart); if (EditorGUI.EndChangeCheck()) { IsVisibleAtStart = isVisibleAtStart; if (IsVisibleAtStart) { ScriptingDefines.AddSymbol(c_visibleDefineSymbol); } else { ScriptingDefines.RemoveSymbol(c_visibleDefineSymbol); } } } else { DebugDraw.IsEnabled = EditorGUILayout.Toggle(new GUIContent("Visible", "Sets whether drawing is visible or not"), DebugDraw.IsEnabled); } } }
private static void UpdateDebugDrawStateSymbols() { switch (CurState) { default: case State.Disabled: ScriptingDefines.RemoveSymbol(c_runtimeDefineSymbol); ScriptingDefines.RemoveSymbol(c_editorDefineSymbol); break; case State.Enabled: ScriptingDefines.AddSymbol(c_runtimeDefineSymbol); ScriptingDefines.RemoveSymbol(c_editorDefineSymbol); break; case State.EditorOnly: ScriptingDefines.RemoveSymbol(c_runtimeDefineSymbol); ScriptingDefines.AddSymbol(c_editorDefineSymbol); break; } }
public static bool IsEnabled() { return(ScriptingDefines.Contains(Define)); }