From 5dafd7f9dce135bd4048fd2acfd6983f25991d94 Mon Sep 17 00:00:00 2001 From: js6pak Date: Sat, 17 Aug 2024 05:23:38 +0200 Subject: [PATCH] Cleanup text after calling GetTextInfo Turns out GetTextInfo changes text internally and because TextBoxTMP#GiveFocus now sets caretPos based on text length it was causing crashes. --- Reactor/Patches/Fixes/CursorPosPatch.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Reactor/Patches/Fixes/CursorPosPatch.cs b/Reactor/Patches/Fixes/CursorPosPatch.cs index 623bac1..d8d6880 100644 --- a/Reactor/Patches/Fixes/CursorPosPatch.cs +++ b/Reactor/Patches/Fixes/CursorPosPatch.cs @@ -23,6 +23,7 @@ public static bool Prefix(TextMeshPro self, ref Vector2 __result) if (self.textInfo == null || self.textInfo.lineCount == 0 || self.textInfo.lineInfo[0].characterCount <= 0) { __result = self.GetTextInfo(" ").lineInfo.First().lineExtents.max; + self.text = string.Empty; return false; }