UnityEditor.Editor.IsEnabled C# (CSharp) Method

IsEnabled() private method

private IsEnabled ( ) : bool
return bool
        internal virtual bool IsEnabled()
        {
            foreach (Object obj2 in this.targets)
            {
                if ((obj2.hideFlags & HideFlags.NotEditable) != HideFlags.None)
                {
                    return false;
                }
                if (EditorUtility.IsPersistent(obj2) && !IsAppropriateFileOpenForEdit(obj2))
                {
                    return false;
                }
            }
            return true;
        }

Usage Example

示例#1
0
        public override void OnGUI(string searchContext)
        {
            if (m_SettingsEditor != null)
            {
                using (new EditorGUI.DisabledScope(!m_SettingsEditor.IsEnabled()))
                {
                    using (new SettingsWindow.GUIScope())
                        m_SettingsEditor.OnInspectorGUI();

                    // Emulate the Inspector by handling DnD at the native level.
                    var remainingRect = GUILayoutUtility.GetRect(GUIContent.none, GUIStyle.none, GUILayout.ExpandHeight(true));
                    if ((Event.current.type == EventType.DragUpdated || Event.current.type == EventType.DragPerform) && remainingRect.Contains(Event.current.mousePosition))
                    {
                        DragAndDrop.visualMode = InternalEditorUtility.InspectorWindowDrag(new[] { m_SettingsEditor.target }, Event.current.type == EventType.DragPerform);
                        if (Event.current.type == EventType.DragPerform)
                        {
                            DragAndDrop.AcceptDrag();
                        }
                    }
                }
            }

            base.OnGUI(searchContext);
        }
All Usage Examples Of UnityEditor.Editor::IsEnabled