using System;
using UnityEngine;
namespace UnityEditor.Rendering
{
/// Editor window that adds a button to browse the help url, specify when defining your inherited class
public class EditorWindowWithHelpButton : EditorWindow
{
static Lazy m_IconHelpGUIContent;
GUIContent iconHelpGUIContent => m_IconHelpGUIContent.Value;
static EditorWindowWithHelpButton()
{
m_IconHelpGUIContent = new Lazy(() => new GUIContent(CoreEditorStyles.iconHelp));
}
/// Shows a button with help icon and opens the url defined by
/// The rect to show the button
[Obsolete("This method will be removed soon. Please override OnHelpButtonClicked instead. #from(2023.1)", error: false)]
protected virtual void ShowButton(Rect r)
{
if (GUI.Button(r, iconHelpGUIContent, CoreEditorStyles.iconHelpStyle))
OnHelpButtonClicked();
}
/// What hapens when the help button is clicked onto. Default implementation use the onto the window class.
protected virtual void OnHelpButtonClicked()
{
Help.ShowHelpForObject(this);
}
}
}