A game about forced loneliness, made by TACStudios
at master 32 lines 1.4 kB view raw
1using System; 2using UnityEngine; 3 4namespace UnityEditor.Rendering 5{ 6 /// <summary>Editor window that adds a button to browse the help url, specify <see cref="HelpURLAttribute"/> when defining your inherited class</summary> 7 public class EditorWindowWithHelpButton : EditorWindow 8 { 9 static Lazy<GUIContent> m_IconHelpGUIContent; 10 GUIContent iconHelpGUIContent => m_IconHelpGUIContent.Value; 11 12 static EditorWindowWithHelpButton() 13 { 14 m_IconHelpGUIContent = new Lazy<GUIContent>(() => new GUIContent(CoreEditorStyles.iconHelp)); 15 } 16 17 /// <summary>Shows a button with help icon and opens the url defined by <see cref="HelpURLAttribute"/></summary> 18 /// <param name="r">The rect to show the button</param> 19 [Obsolete("This method will be removed soon. Please override OnHelpButtonClicked instead. #from(2023.1)", error: false)] 20 protected virtual void ShowButton(Rect r) 21 { 22 if (GUI.Button(r, iconHelpGUIContent, CoreEditorStyles.iconHelpStyle)) 23 OnHelpButtonClicked(); 24 } 25 26 /// <summary>What hapens when the help button is clicked onto. Default implementation use the <see cref="HelpURLAttribute"/> onto the window class.</summary> 27 protected virtual void OnHelpButtonClicked() 28 { 29 Help.ShowHelpForObject(this); 30 } 31 } 32}