From bbdbd5bec87c32b0f6c793648def78637bd11d2b Mon Sep 17 00:00:00 2001 From: Alexejhero <32238504+Alexejhero@users.noreply.github.com> Date: Tue, 13 Aug 2024 21:13:03 +0300 Subject: [PATCH] Fix ambiguous patch exception --- Reactor/Patches/Fixes/CursorPosPatch.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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)