Пример #1
0
 private void UpdateDefineSymbols()
 {
     if (m_isEnabled == false)
     {
         ScriptingDefines.AddSymbol(c_disabledDefineSymbol);
     }
     else
     {
         ScriptingDefines.RemoveSymbol(c_disabledDefineSymbol);
     }
 }
Пример #2
0
        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);
                }
            }
        }
Пример #3
0
        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;
            }
        }