Ourpalm / ILRuntime

Pure C# IL Intepreter Runtime, which is fast and reliable for scripting requirement on enviorments, where jitting isn't possible.
Other
2.99k stars 656 forks source link

Cannot find method:get_runtimeAnimatorController in type:UnityEngine.Animator, token=UnityEngine.RuntimeAnimatorController UnityEngine.Animator::get_runtimeAnimatorController() #686

Open Gerson2017 opened 2 years ago

Gerson2017 commented 2 years ago

这个问题不是必先,在主工程增加了 public override void InitAmEvt(Dictionary<uint, List> anEvtDic, RuntimeAnimatorController controller = null, bool isSecondSkill = false) { if (this.MyAnimator == null && controller == null) { MyDebuger.LogError(string.Format("{0} not found Animator", this.gameObject.name)); return; } AnimationClip[] attackClips = null; if (controller == null) attackClips = MyAnimator.runtimeAnimatorController.animationClips; else attackClips = controller.animationClips;� } (没有完全复制)

及静态方法 public class TestAniamtorController : MonoBehaviour {

public static Animator m_am;

public static void Test() { AnimationClip[] clips= m_am.runtimeAnimatorController.animationClips; } }�

仍然会有该问题

app崩溃 | 34:12.7 | 117064159 | exception_type: Exception
exception_message: KeyNotFoundException: Cannot find method:get_runtimeAnimatorController in type:UnityEngine.Animator, token=UnityEngine.RuntimeAnimatorController UnityEngine.Animator::get_runtimeAnimatorController()
stack_trace: ILRuntime.Runtime.Enviorment.AppDomain.GetMethod (System.Object token, ILRuntime.CLR.TypeSystem.ILType contextType, ILRuntime.CLR.Method.ILMethod contextMethod, System.Boolean& invalidToken) (at <00000000000000000000000000000000>:0) ILRuntime.CLR.Method.ILMethod.InitToken (ILRuntime.Runtime.Intepreter.OpCodes.OpCode& code, System.Object token, System.Collections.Generic.Dictionary2[TKey,TValue] addr) (at <00000000000000000000000000000000>:0) ILRuntime.CLR.Method.ILMethod.InitStackCodeBody (System.Collections.Generic.Dictionary2[TKey,TValue] addr) (at <00000000000000000000000000000000>:0) ILRuntime.CLR.Method.ILMethod.InitCodeBody (System.Boolean register) (at <00000000000000000000000000000000>:0) ILRuntime.CLR.Method.ILMethod.get_Body () (at <00000000000000000000000000000000>:0) ILRuntime.Runtime.Intepreter.ILIntepreter.Execute (ILRuntime.CLR.Method.ILMethod method, ILRuntime.Runtime.Stack.StackObject esp, System.Boolean& unhandledException) (at <00000000000000000000000000000000>:0) ILRuntime.Runtime.Intepreter.ILIntepreter.Execute (ILRuntime.CLR.Method.ILMethod method, ILRuntime.Runtime.Stack.StackObject esp, System.Boolean& unhandledException) (at <00000000000000000000000000000000>:0) ILRuntime.Runtime.Intepreter.ILIntepreter.Execute (ILRuntime.CLR.Method.ILMethod method, ILRuntime.Runtime.Stack.StackObject esp, System.Boolean& unhandledException) (at <00000000000000000000000000000000>:0) ILRuntime.Runtime.Intepreter.DelegateAdapter.ILInvokeSub (ILRuntime.Runtime.Intepreter.ILIntepreter intp, ILRuntime.Runtime.Stack.StackObject esp, System.Collections.Generic.IList1[T] mStack) (at <00000000000000000000000000000000>:0) ILRuntime.Runtime.Intepreter.DelegateAdapter.ILInvoke (ILRuntime.Runtime.Intepreter.ILIntepreter intp, ILRuntime.Runtime.Stack.StackObject* esp, System.Collections.Generic.IList1[T] mStack) (at <00000000000000000000000000000000>:0) ILRuntime.Runtime.Intepreter.ILIntepreter.Execute (ILRuntime.CLR.Method.ILMethod method, ILRuntime.Runtime.Stack.StackObject esp, System.Boolean& unhandledException) (at <00000000000000000000000000000000>:0) ILRuntime.Runtime.Intepreter.ILIntepreter.Execute (ILRuntime.CLR.Method.ILMethod method, ILRuntime.Runtime.Stack.StackObject esp, System.Boolean& unhandledException) (at <00000000000000000000000000000000>:0) ILRuntime.Runtime.Intepreter.DelegateAdapter.ILInvokeSub (ILRuntime.Runtime.Intepreter.ILIntepreter intp, ILRuntime.Runtime.Stack.StackObject esp, System.Collections.Generic.IList`1[T] mStack) (at <00000000000000000000000000000000>:0) ILRuntime.Runtime.Intepreter.DelegateAdapter.ILInvoke (ILRuntime.Runtime.Intepreter.ILIntepreter intp, ILRuntime.Runtime.Stack.StackObject esp, System.Collections.Generic.IList1[T] mStack) (at <00000000000000000000000000000000>:0) ILRuntime.Runtime.Intepreter.MethodDelegateAdapter3[T1,T2,T3].InvokeILMethod (T1 p1, T2 p2, T3 p3) (at <00000000000000000000000000000000>:0) System.Action3[T1,T2,T3].Invoke (T1 arg1, T2 arg2, T3 arg3) (at <00000000000000000000000000000000>:0) ILRuntime.Runtime.Generated.GersonFrame_MsgDispatcher_Binding.SendTypeMsg_4 (ILRuntime.Runtime.Intepreter.ILIntepreter __intp, ILRuntime.Runtime.Stack.StackObject* __esp, System.Collections.Generic.IList1[T] mStack, ILRuntime.CLR.Method.CLRMethod method, System.Boolean isNewObj) (at <00000000000000000000000000000000>:0) ILRuntime.Runtime.Enviorment.CLRRedirectionDelegate.Invoke (ILRuntime.Runtime.Intepreter.ILIntepreter intp, ILRuntime.Runtime.Stack.StackObject esp, System.Collections.Generic.IList`1[T] mStack, ILRuntime.CLR.Method.CLRMethod method, System.Boolean isNewObj) (at <00000000000000000000000000000000>:0) ILRuntime.Runtime.Intepreter.ILIntepreter.Execute (ILRuntime.CLR.Method.ILMethod method, ILRuntime.Runtime.Stack.StackObject esp, System.Boolean& unhandledException) (at <00000000000000000000000000000000>:0) ILRuntime.Runtime.Intepreter.DelegateAdapter.ILInvokeSub (ILRuntime.Runtime.Intepreter.ILIntepreter intp, ILRuntime.Runtime.Stack.StackObject esp, System.Collections.Generic.IList`1[T] mStack) (at <00000000000000000000000000000000>:0) ILRuntime.Runtime.Intepreter.DelegateAdapter.ILInvoke (ILRuntime.Runtime.Intepreter.ILIntepreter intp, ILRuntime.Runtime.Stack.StackObject esp, System.Collections.Generic.IList1[T] mStack) (at <00000000000000000000000000000000>:0) ILRuntime.Runtime.Intepreter.MethodDelegateAdapter2[T1,T2].InvokeILMethod (T1 p1, T2 p2) (at <00000000000000000000000000000000>:0) System.Action`2[T1,T2].Invoke (T1 arg1, T2 arg2) (at <00000000000000000000000000000000>:0) DragonRun.NetTcp.Update () (at <00000000000000000000000000000000>:0) Rethrow as ILRuntimeException: Cannot find method:get_runtimeAnimatorController in type:UnityEngine.Animator, token=UnityEngine.RuntimeAnimatorController UnityEngine.Animator::get_runtimeAnimatorController() HotFix_Dragon.Fight_Hot.HotFeiNa.UpdatePassiveSkill() HotFix_Dragon.Fight_Hot.HotFeiNa.OnGetFightDate() HotFix_Dragon.Fight_Hot.HeroFightModel.UpdateFightInfo(HotFix_Dragon.Model.HeroAddAllPropeityInfo heroProp, System.Int32 level) HotFix_Dragon.Fight_Hot.HeroFightModel.OnGetFightInfo(System.Object arg1, System.Object arg2, System.Object arg3) Rethrow as ILRuntimeException: Cannot find method:get_runtimeAnimatorController in type:UnityEngine.Animator, token=UnityEngine.RuntimeAnimatorController UnityEngine.Animator::get_runtimeAnimatorController() HotFix_Dragon.Fight_Hot.HotFeiNa.UpdatePassiveSkill() HotFix_Dragon.Fight_Hot.HotFeiNa.OnGetFightDate() HotFix_Dragon.Fight_Hot.HeroFightModel.UpdateFightInfo(HotFix_Dragon.Model.HeroAddAllPropeityInfo heroProp, System.Int32 level) HotFix_Dragon.Fight_Hot.HeroFightModel.OnGetFightInfo(System.Object arg1, System.Object arg2, System.Object arg3) Rethrow as ILRuntimeException: Cannot find method:get_runtimeAnimatorController in type:UnityEngine.Animator, token=UnityEngine.RuntimeAnimatorController UnityEngine.Animator::get_runtimeAnimatorController() HotFix_Dragon.Fight_Hot.HotFeiNa.UpdatePassiveSkill() HotFix_Dragon.Fight_Hot.HotFeiNa.OnGetFightDate() HotFix_Dragon.Fight_Hot.HeroFightModel.UpdateFightInfo(HotFix_Dragon.Model.HeroAddAllPropeityInfo heroProp, System.Int32 level) HotFix_Dragon.Fight_Hot.HeroFightModel.OnGetFightInfo(System.Object arg1, System.Object arg2, System.Object arg3) 
| Xiaomi | WIFI | Android | 11 | 陕西 | 6 | 1 |

tinysnake commented 2 years ago

类型被裁剪了,在link.xml里添加对AnimatorController类型所有成员进行保留,具体参考官方文档: https://docs.unity3d.com/Manual/ManagedCodeStripping.html