mirror of
https://github.com/codewriter-packages/Tri-Inspector.git
synced 2025-01-22 08:18:49 -05:00
26 lines
791 B
C#
26 lines
791 B
C#
|
using System;
|
|||
|
using UnityEditor;
|
|||
|
using UnityEngine;
|
|||
|
|
|||
|
namespace TriInspectorUnityInternalBridge
|
|||
|
{
|
|||
|
internal static class GUIClipProxy
|
|||
|
{
|
|||
|
private static Func<Vector2, Vector2> _guiClipUnClipVector2;
|
|||
|
|
|||
|
[InitializeOnLoadMethod]
|
|||
|
private static void Setup()
|
|||
|
{
|
|||
|
var imGuiModuleAssembly = typeof(GUI).Assembly;
|
|||
|
var guiClipType = imGuiModuleAssembly.GetType("UnityEngine.GUIClip", throwOnError: true);
|
|||
|
|
|||
|
_guiClipUnClipVector2 = (Func<Vector2, Vector2>) Delegate.CreateDelegate(typeof(Func<Vector2, Vector2>),
|
|||
|
guiClipType.GetMethod("Unclip", new[] {typeof(Vector2)}));
|
|||
|
}
|
|||
|
|
|||
|
public static Vector2 UnClip(Vector2 pos)
|
|||
|
{
|
|||
|
return _guiClipUnClipVector2.Invoke(pos);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|