diff --git a/Reactor/Patches/Fixes/CursorPosPatch.cs b/Reactor/Patches/Fixes/CursorPosPatch.cs index 912ebc2..623bac1 100644 --- a/Reactor/Patches/Fixes/CursorPosPatch.cs +++ b/Reactor/Patches/Fixes/CursorPosPatch.cs @@ -1,4 +1,6 @@ +using System.Collections.Generic; using System.Linq; +using System.Reflection; using HarmonyLib; using TMPro; using UnityEngine; @@ -8,9 +10,14 @@ namespace Reactor.Patches.Fixes; /// /// "Fixes" an issue where empty TextBoxes have wrong cursor positions. /// -[HarmonyPatch(typeof(TextMeshProExtensions), nameof(TextMeshProExtensions.CursorPos))] +[HarmonyPatch] internal static class CursorPosPatch { + public static IEnumerable TargetMethods() + { + return AccessTools.GetDeclaredMethods(typeof(TextMeshProExtensions)).Where(m => m.Name == nameof(TextMeshProExtensions.CursorPos)); + } + public static bool Prefix(TextMeshPro self, ref Vector2 __result) { if (self.textInfo == null || self.textInfo.lineCount == 0 || self.textInfo.lineInfo[0].characterCount <= 0)