noodle1983 / UnityAndroidIl2cppPatchDemo

这是Unity Android APP il2cpp热更完美解决方案的Demo。更新build_demo_apk里的Unity路径,执行即可一键重build Patch和apk。因为文件libunity是没有热更的,如unity版本有变化则热更不适用。

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

对枚举类型进行实现扩展函数会patch失败

moyubing0514 opened this issue · comments

使用枚举类型扩展函数会导致E:CSharpException:ArgumentNullException: Value cannot be null 报错.
无法patch的C#代码如下:

using UnityEngine;
public class Test : MonoBehaviour
{
void Start() {
TestEnum.A.TestFunc();
}
}
public enum TestEnum {
A,
B,
C
}
public static class TestStatic {
public static void TestFunc(this TestEnum type) {
Debug.Log(type.ToString());
}
}

修改成常规静态方法不再报错,修改后如下:
using UnityEngine;
public class Test : MonoBehaviour
{
void Start() {
TestStatic.TestFunc(TestEnum.A);
}
}
public enum TestEnum {
A,
B,
C
}
public static class TestStatic {

public static void TestFunc(TestEnum type) {
    Debug.Log(type.ToString());
}

}