XLua 遇到的问题

在lua端调用dotween的to方法的时候报错 

CS.DG.Tweening.DOTween.To

LuaException: c# exception:XLua.LuaException: c# exception:System.InvalidCastException: This type must add to CSharpCallLua: DG.Tweening.Core.DOGetter`1[UnityEngine.Vector2]
  at XLua.ObjectTranslator.getDelegate (XLua.DelegateBridgeBase bridge, System.Type delegateType) [0x000ad] in E:\nxclient_android\Assets\XLua\Src\ObjectTranslator.cs:374 
  at XLua.ObjectTranslator.CreateDelegateBridge (IntPtr L, System.Type delegateType, Int32 idx) [0x00191] in E:\nxclient_android\Assets\XLua\Src\ObjectTranslator.cs:445 
stack traceback:
    [C]: in field 'To'

 

解决方法:添加两个对应功能的委托

    [CSharpCallLua]
    public delegate Vector2 Vector2Getter();

    [CSharpCallLua]
    public delegate void Vector2Setter(Vector2 ve2);

 

 

你可能感兴趣的:(Unity3D)