Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions Runtime/Helpers/GUIHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
using UnityEngine;

public static class GUIHelper
{
private static readonly GUIStyle _closeButtonStyle = GUI.skin.FindStyle("ToolbarSeachCancelButton");
{
private static readonly GUIStyle _closeButtonStyle = FindCloseButtonStyle();

/// <summary>Draws the close button.</summary>
/// <param name="buttonRect">Rect the button should be located in.</param>
Expand Down Expand Up @@ -34,6 +34,17 @@ [PublicAPI] public static bool CloseButton(Rect buttonRect)
/// <param name="viewRect">The rectangle used inside the scrollView.</param>
public static ScrollView ScrollViewBlock(Rect position, ref Vector2 scrollPosition, Rect viewRect) => new ScrollView(position, ref scrollPosition, viewRect);

private static GUIStyle FindCloseButtonStyle()
{
// Name was changed in Unity 2023.2, 2021.3.28, 2022.3.1
GUIStyle style = GUI.skin.FindStyle("ToolbarSearchCancelButton");
if (style == null)
{
style = GUI.skin.FindStyle("ToolbarSeachCancelButton");
}
return style;
}

public readonly struct ScrollView : IDisposable
{
public ScrollView(Rect position, ref Vector2 scrollPosition, Rect viewRect)
Expand Down