Unity 2022.3.62f1 出现错误:“字符串转换错误:输入中遇到非法字节序列”
The project upgraded from Unity2019 to Unity2022 and encountered the above error. The corresponding stack trace is as follows: **LUA: c# exception in print:System.ArgumentException: Illegal byte sequence encounted in the input. Parameter name: string at (wrapper managed-to-native) System.Runtime.InteropServices.Marshal.PtrToStringAnsi(intptr, int) at XLua.LuaDLL.Lua.lua_tostring(System.IntPtr L, System.Int32 index) [0x0001b] in E:\Branch\branch_unity2022\trunk\client\Assets\3rdParty\XLua\Src\LuaDLL.cs:302 at XLua.StaticLuaCallbacks.PrintInternal(System.IntPtr L, System.String& s, System.String& stackTraceback) [0x00076] in E:\Branch\branch_unity2022\trunk\client\Assets\3rdParty\XLua\Src\StaticLuaCallbacks.cs:915 at XLua.StaticLuaCallbacks.Print(System.IntPtr L) [0x0000d] in E:\Branch\branch_unity2022\trunk\client\Assets\3rdParty\XLua\Src\StaticLuaCallbacks.cs:839 stack traceback: [C]: in function 'print'** 1. Related issues: https://GitHub.com/mono/mono/issues/7117 2. Fixing method reference: https://GitHub.com/Lunatic-Works/Nova/issues/6 The current fixing method is as follows: add the macro definition of UNITY_2022_1_OR_NEWER, which can solve the error. However, we still hope that the official team can provide a more perfect fixing method. Thank you!
内容来源: Tencent/xLua