// 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); }
internal static SelectionRenderState GetSelectionRenderState() { bool wireframe = false, outline = false; try { wireframe = (bool)ReflectionUtility.GetValue(null, "UnityEditor.AnnotationUtility", "showSelectionWire"); outline = (bool)ReflectionUtility.GetValue(null, "UnityEditor.AnnotationUtility", "showSelectionOutline"); } catch { Log.Warning("Looks like Unity changed the AnnotationUtility \"showSelectionOutline\"\nPlease email [email protected] and let Karl know!"); } SelectionRenderState state = SelectionRenderState.None; if (wireframe) { state |= SelectionRenderState.Wireframe; } if (outline) { state |= SelectionRenderState.Outline; } return(state); }
internal static MenuOption Show(System.Action onSettingsGUI, System.Action onSettingsEnable, System.Action onSettingsDisable) { MenuOption win = EditorWindow.GetWindow <MenuOption>(true, "Options", true); win.hideFlags = HideFlags.HideAndDontSave; if (win.onSettingsDisable != null) { win.onSettingsDisable(); } if (onSettingsEnable != null) { onSettingsEnable(); } win.onSettingsDisable = onSettingsDisable; win.onSettingsGUI = onSettingsGUI; // don't let window hang around after a script reload nukes the pb_MenuAction instances object parent = ReflectionUtility.GetValue(win, typeof(EditorWindow), "m_Parent"); object window = ReflectionUtility.GetValue(parent, typeof(EditorWindow), "window"); ReflectionUtility.SetValue(parent, "mouseRayInvisible", true); ReflectionUtility.SetValue(window, "m_DontSaveToLayout", true); win.Show(); return(win); }
// 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); }