focus-creative-games / hybridclr

HybridCLR是一个特性完整、零成本、高性能、低内存的Unity全平台原生c#热更新解决方案。 HybridCLR is a fully featured, zero-cost, high-performance, low-memory solution for Unity's all-platform native c# hotupdate.
https://code-philosophy.com/
MIT License
6.51k stars 656 forks source link

DHE计算等价性问题 #52

Closed AlanLiu90 closed 1 year ago

AlanLiu90 commented 1 year ago

环境

Unity 2020.3.33
il2cpp_plus 2020-DHE
hybridclr DHE
hybridclr_unity DHE
OS+Build Windows 10 64 bit
project dhe_demo(没开间接函数优化)

问题

下面代码可复现问题(B.Func1被标记为变化,但Case23.RunHotUpdateMain .Start没有被标记为变化):

public interface IA
{
    void Func1();
}

public class B : IA
{
    public void Func1()
    {
#if DHE_HOT_UPDATE
        UnityEngine.Debug.Log("1");
#else
        UnityEngine.Debug.Log("2");
#endif
    }
}

public class Case23
{
    public static void Run()
    {
        var b = new B();
        b.Func1();
    }
}

public class HotUpdateMain : MonoBehaviour
{
    void Start()
    {
        Case23.Run();
    }
}

期望输出:1 实际输出:2

复现工程:dhe_demo.zip(如果单独使用上面代码复现不了问题,可以使用该工程)

pirunxi commented 1 year ago

修复了。更新 hybridclr_unity即可。