New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
热更成功,但有个方法Patch会报错 #36
Comments
il2cpp因为不支持jit,某些泛型是没法动态实例化。 |
我想问下大神,这个某些泛型动态实例化,是需要把泛型先实例化,还是说修复的代码最好,不要包含泛型代码,如果我想修复这段代码,有没有什么方法可以实现。 |
总之报这错代表这泛型参数的函数调用不了。 |
好的,谢谢了 |
谢谢大佬 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
报错:System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ExecutionEngineException: Attempting to call method 'MBaseView::GetView' for which no ahead of time (AOT) code was generated.
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in :0
at IFix.Core.ReflectionMethodInvoker.Invoke (IFix.Core.VirtualMachine virtualMachine, Call& call, Boolean isInstantiate) [0x00000] in :0
at IFix.Core.VirtualMachine.Execute (IFix.Core.Instruction* pc, IFix.Core.Value* argumentBase, System.Object[] managedStack, IFix.Core.Value* evaluationStackBase, Int32 argsCount, Int32 methodIndex, Int32 refCount, IFix.Core.Value** topWriteBack) [0x00000] in :0
at IFix.Core.VirtualMachine.Execute (Int32 methodIndex, Call& call, Int32 argsCount, Int32 refCount) [0x00000] in :0
at IFix.ILFixDynamicMethodWrapper.__Gen_Wrap_0 (System.Object P0) [0x00000] in :0
at BaseView.OnShowLoadComplete (.CacheInfoData cacheInfo, System.Object[] args) [0x00000] in :0
at AssetsCachePool.onLoadComplete (.AssetsData ad, System.Object[] args) [0x00000] in :0
at Assets+c__Iterator0.MoveNext () [0x00000] in :0
at UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) [0x00000] in :0
--- End of inner exception stack trace ---
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in :0
at IFix.Core.ReflectionMethodInvoker.Invoke (IFix.Core.VirtualMachine virtualMachine, Call& call, Boolean isInstantiate) [0x00000] in :0
at IFix.Core.VirtualMachine.Execute (IFix.Core.Instruction* pc, IFix.Core.Value* argumentBase, System.Object[] managedStack, IFix.Core.Value* evaluationStackBase, Int32 argsCount, Int32 methodIndex, Int32 refCount, IFix.Core.Value** topWriteBack) [0x00000] in :0
at IFix.Core.VirtualMachine.Execute (Int32 methodIndex, Call& call, Int32 argsCount, Int32 refCount) [0x00000] in :0
at IFix.ILFixDynamicMethodWrapper.__Gen_Wrap_0 (System.Object P0) [0x00000] in :0
at MBaseView.OnShowLoadComplete (.CacheInfoData cacheInfo, System.Object[] args) [0x00000] in :0
方法:
[IFix.Patch]
public void InitUserInfoData()
{
if(null == mUserHead)
mUserHead = GetView(预制体, 父预制体);
// userName.text = this.Nickname; //原代码
userName.text = "热更代码测试"; //patch修改的部分
}
PS:
1、这个要Patch的方法InitUserInfoData(),是在加载预制体的回调里调用的。
2、GetView()是父类的一个方法,具体如下
public virtual T GetView(Transform source, Transform parent = null, SyncEvent Event = null) where T : BaseViewWidgets
{
//实例化操作
}
3、在同一脚本下,热更其他方法是正常的。
请问大神这个也是因为泛型的原因吗?
The text was updated successfully, but these errors were encountered: