// much like highlander, there can only be one
        public static TooltipEditor instance()
        {
            if (s_Instance == null)
            {
                s_Instance           = CreateInstance <TooltipEditor>();
                s_Instance.minSize   = Vector2.zero;
                s_Instance.maxSize   = Vector2.zero;
                s_Instance.hideFlags = HideFlags.HideAndDontSave;
#if UNITY_2019_1_OR_NEWER
                s_Instance.ShowTooltip();
                s_Instance.m_Parent.window.SetAlpha(1f);
#else
                if (s_ShowPopupWithModeMethod != null && s_ShowModeEnum != null)
                {
                    s_ShowPopupWithModeMethod.Invoke(s_Instance, new [] { Enum.ToObject(s_ShowModeEnum, 1), false });
                }
                else
                {
                    s_Instance.ShowPopup();
                }
#endif

                object parent = ReflectionUtility.GetValue(s_Instance, s_Instance.GetType(), "m_Parent");
                object window = ReflectionUtility.GetValue(parent, parent.GetType(), "window");
                ReflectionUtility.SetValue(parent, "mouseRayInvisible", true);
                ReflectionUtility.SetValue(window, "m_DontSaveToLayout", true);
            }

            return(s_Instance);
        }
Пример #2
0
        // much like highlander, there can only be one
        public static TooltipEditor instance()
        {
            if (s_Instance == null)
            {
                s_Instance           = ScriptableObject.CreateInstance <TooltipEditor>();
                s_Instance.minSize   = Vector2.zero;
                s_Instance.maxSize   = Vector2.zero;
                s_Instance.hideFlags = HideFlags.HideAndDontSave;
                s_Instance.ShowPopup();

                object parent = ReflectionUtility.GetValue(s_Instance, s_Instance.GetType(), "m_Parent");
                object window = ReflectionUtility.GetValue(parent, parent.GetType(), "window");
                ReflectionUtility.SetValue(parent, "mouseRayInvisible", true);
                ReflectionUtility.SetValue(window, "m_DontSaveToLayout", true);
            }

            return(s_Instance);
        }