mirror of
https://github.com/GrahamKracker/UnityExplorer.git
synced 2025-07-16 00:07:52 +08:00
1.5.3
* Added exception handling for scrollview when unstripping fails * Added some better logging in some places
This commit is contained in:
@ -10,6 +10,35 @@ namespace Explorer
|
||||
{
|
||||
public class UIHelpers
|
||||
{
|
||||
private static bool ScrollUnstrippingFailed = false;
|
||||
|
||||
public static Vector2 BeginScrollView(Vector2 scroll) => BeginScrollView(scroll, null);
|
||||
|
||||
public static Vector2 BeginScrollView(Vector2 scroll, GUIStyle style, params GUILayoutOption[] layoutOptions)
|
||||
{
|
||||
if (ScrollUnstrippingFailed) return scroll;
|
||||
|
||||
try
|
||||
{
|
||||
if (style != null)
|
||||
return GUILayout.BeginScrollView(scroll, style, layoutOptions);
|
||||
else
|
||||
return GUILayout.BeginScrollView(scroll, layoutOptions);
|
||||
}
|
||||
catch
|
||||
{
|
||||
ScrollUnstrippingFailed = true;
|
||||
return scroll;
|
||||
}
|
||||
}
|
||||
|
||||
public static void EndScrollView()
|
||||
{
|
||||
if (ScrollUnstrippingFailed) return;
|
||||
|
||||
GUILayout.EndScrollView();
|
||||
}
|
||||
|
||||
// helper for "Instantiate" button on UnityEngine.Objects
|
||||
public static void InstantiateButton(Object obj, float width = 100)
|
||||
{
|
||||
|
Reference in New Issue
Block a user