示例#1
0
        protected bool Enable(bool force = false)
        {
            try
            {
                if (!force)
                {
                    switch (target)
                    {
                    case MonoBehaviour monoBehaviour when Selection.activeObject != monoBehaviour.gameObject:
                    case ScriptableObject _ when Selection.activeObject != target:
                        return(false);
                    }
                }

                m_drawer = new MightyDrawer();
                m_drawer.OnEnableMonoScript(target, serializedObject);
            }
            catch (Exception ex)
            {
                if (ex.GetType().Name != "SerializedObjectNotCreatableException")
                {
                    // This is a terrible fix, but it'll be enough until I find what's actually triggering this...
                    // It might have to do with additive scenes or prefabs
                    Debug.LogException(ex);
                }

                return(false);
            }

            return(true);
        }
示例#2
0
 private void Enable()
 {
     m_drawer = new MightyDrawer();
     try
     {
         m_drawer.OnEnableMonoScript(target, serializedObject);
     }
     catch
     {
         // ignored
     }
 }