vovgou / loxodon-framework

An MVVM & Databinding framework that can use C# and Lua to develop games
MIT License
1.9k stars 362 forks source link

Async & Await Tutorials Error #22

Closed cuikeqiang closed 2 years ago

cuikeqiang commented 2 years ago

Unity 2020.3.4f1 When I run Assets/Samples/Loxodon Framework XLua/2.0.0/Examples/Async & Await Tutorials.unity I get this error. Why is it happening and how should I fix it?

InvalidCastException: This type must add to CSharpCallLua: Loxodon.Framework.Asynchronous.ILuaTask XLua.DelegateBridge.Func[T1,TResult] (T1 p1) (at Assets/XLua/Src/GenericDelegateBridge.cs:157) Loxodon.Framework.Views.LuaBehaviour+d15.MoveNext () (at Assets/LoxodonFramework/XLua/Runtime/Framework/Views/LuaBehaviour.cs:116) --- End of stack trace from previous location where exception was thrown --- System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at <695d1cc93cca45069c528c15c9fdd749>:0) System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.b6_0 (System.Object state) (at <695d1cc93cca45069c528c15c9fdd749>:0) UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at /Users/bokken/buildslave/unity/build/Runtime/Export/Scripting/UnitySynchronizationContext.cs:153) UnityEngine.UnitySynchronizationContext:ExecuteTasks() (at /Users/bokken/buildslave/unity/build/Runtime/Export/Scripting/UnitySynchronizationContext.cs:107)

vovgou commented 2 years ago

这个错误已经提示你了啊,你必须配置CSharpCallLua ,你去看看xlua的文档,怎么导出C#的类和委托。