ourpalm / ilruntimeu3d Goto Github PK
View Code? Open in Web Editor NEWUnity3D demo project for ILRuntime
Unity3D demo project for ILRuntime
运行继承适配器例子,InheritanceAdapter 的 public override System.Int32 Value 属性方法里面会报错。
NullReferenceException: Object reference not set to an instance of an object ILRuntime.CLR.TypeSystem.CLRType.GetMethod (System.String name, System.Collections.Generic.List
1[T] param, ILRuntime.CLR.TypeSystem.IType[] genericArguments, ILRuntime.CLR.TypeSystem.IType returnType, System.Boolean declaredOnly) (at Library/PackageCache/[email protected]/CLR/TypeSystem/CLRType.cs:705)
ILRuntime.Runtime.Enviorment.CrossBindingAdaptor.GetMethod (System.String name, System.Collections.Generic.List1[T] param, ILRuntime.CLR.TypeSystem.IType[] genericArguments, ILRuntime.CLR.TypeSystem.IType returnType, System.Boolean declaredOnly) (at Library/PackageCache/[email protected]/Runtime/Enviorment/CrossBindingAdaptor.cs:52) ILRuntime.Runtime.Enviorment.CrossBindingMethodInfo.EnsureMethod (ILRuntime.Runtime.Intepreter.ILTypeInstance ins) (at Library/PackageCache/[email protected]/Runtime/Enviorment/CrossBindingMethodInfo.cs:729) ILRuntime.Runtime.Enviorment.CrossBindingMethodInfo.CheckShouldInvokeBase (ILRuntime.Runtime.Intepreter.ILTypeInstance ins) (at Library/PackageCache/[email protected]/Runtime/Enviorment/CrossBindingMethodInfo.cs:699) ILRuntimeDemo.TestClassBaseAdapter+Adapter.get_Value () (at Assets/Samples/ILRuntime/1.6.3/Demo/Scripts/Examples/04_Inheritance/InheritanceAdapter.cs:70) Inheritance.OnHotFixLoaded () (at Assets/Samples/ILRuntime/1.6.3/Demo/Scripts/Examples/04_Inheritance/Inheritance.cs:117) Inheritance+<LoadHotFixAssembly>d__4.MoveNext () (at Assets/Samples/ILRuntime/1.6.3/Demo/Scripts/Examples/04_Inheritance/Inheritance.cs:92) UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at D:/unity/Runtime/Export/Coroutines.cs:17)
System_Single_Binding.cs(251,55): error CS0117: 'float' does not contain a definition for 'IsFinite'
就是这编写代码的人员实在水平不行,这么好的工具,写的例子,那叫丑!
问题:ILRuntime层调用async方法时,如果方块内没有await代码块,则不会有返回,请问下这个问题如何处理?
复现方式:
1、我们使用的是这个链接下的实例,https://github.com/Ourpalm/ILRuntimeU3D/tree/master/ILRuntimeDemo。
2、在这个实例中,我们加入了一个处理async/await的跨域适配器,该适配器代码已打包成zip。
AsyncStateMachineAdaptor.zip
3、我们在Assets/Samples/ILRuntime/2.1.0/_Scenes/Examples/01_HelloWorld的场景里的nitializeILRuntime()方法中加入跨域注册的代码:appdomain.RegisterCrossBindingAdaptor(new AsyncStateMachineAdaptor());
4、我们在ILRuntime的工程中的StaticFunTest()中加入逻辑代码:
public static async void StaticFunTest()
{
UnityEngine.Debug.Log("!!! InstanceClass.StaticFunTest()");
string s = await SetAsyncTest(false);
UnityEngine.Debug.Log(s);
UnityEngine.Debug.Log("!!! 111111111");
}
public static async Task<string> SetAsyncTest(bool flag)
{
if (flag == true)
{
await Task.Delay(1000);
UnityEngine.Debug.Log("测试有await");
return "测试有awaitReturn";
}
else
{
//如果是执行这段代码,如是没有下面的await Task.Yield()代码块,则不能接收到return的返回,
//当加入await Task.Yield()代码块后,才能正常的返回。
//尝试使用Task.FromResult("");也不行。
//await Task.Yield();
UnityEngine.Debug.Log("测试没有await");
return "测试没有awaitReturn";
}
}
5、我们获取到测试结果:
当以上方法中flag=true的时候,方法中有await Task.Delay代码块,能正常获取到返回值。
当以上方法中flag=false的时候,方法中没有await Task代码块,无法正常获取到返回,也就是说
StaticFunTest方法中的如下代码不会执行。
UnityEngine.Debug.Log(s);
UnityEngine.Debug.Log("!!! 111111111");
编辑器上点击单ILRuntime->Generate之后出现报错。Unity版本2018.4.0f1
大佬,怎么不重启Unity更新ILRuntime逻辑
vs打开hotfit_project后,右键菜单点击生成后报错,
请问下如何编译 热更DLL的vs工程 @liiir1985
1>------ 已启动生成: 项目: HotFix_Project, 配置: Debug Any CPU ------
1>E:\cst\demo\My project\Assets\Samples\ILRuntime\2.0.2\Demo\HotFix_Project~\TestInheritance.cs(7,36,7,49): error CS0012: 类型“Object”在未引用的程序集中定义。必须添加对程序集“netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51”的引用。
1>E:\cst\demo\My project\Assets\Samples\ILRuntime\2.0.2\Demo\HotFix_Project~\TestDelegate.cs(8,16,8,34): error CS0012: 类型“MulticastDelegate”在未引用的程序集中定义。必须添加对程序集“netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51”的引用。
1>E:\cst\demo\My project\Assets\Samples\ILRuntime\2.0.2\Demo\HotFix_Project~\TestDelegate.cs(9,16,9,36): error CS0012: 类型“MulticastDelegate”在未引用的程序集中定义。必须添加对程序集“netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51”的引用。
1>E:\cst\demo\My project\Assets\Samples\ILRuntime\2.0.2\Demo\HotFix_Project~\TestInheritance.cs(21,23,21,38): error CS0012: 类型“Object”在未引用的程序集中定义。必须添加对程序集“netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51”的引用。
========== 生成: 成功 0 个,失败 1 个,最新 0 个,跳过 0 个 ==========
跨域实现域外的多个接口也会抛异常。
Can you update the project?The lack of namespace.
我需要用反射的方式获取子类的父类方法,但是会报错,说找不到子类的方法
在unity2019.2.0a下运行显示:
BadImageFormatException: Format of the executable (.exe) or library (.dll) is invalid.
class TestTraceStack
{
public static void RunTest()
{
var s = HelloWorld.appdomain.GetCurrentStackTrace();//注释掉就不会有问题
UnityEngine.GameObject go = new UnityEngine.GameObject();
UnityEngine.Debug.Log(go.name);//报错,提示go是一个null
}
}
这个测试样例,为了取到appdomain,这里把HelloWorld.appdomain改成了静态属性。
打开 Samples\ILRuntime\2.0.2\Demo\HotFix_Project~ 工程之后,报错缺少脚本 TestDelegateMethod TestDelegateFunction TestClassBase
使用unity案例工程中的CoroutineDemo,先运行Unity再“Attack to ILRuntime”,(ps.目前有安装官方调试插件,有去掉ILRUNTIME_DEBUG_DISABLE 宏),不能调试,显示为“cannot connect to ILRuntime”。查看端口,发现56000端口不存在,尝试更改端口为50000,再次查看端口,50000端口已存在,运行unity后,“Attack to ILRuntime”后显示“ILRuntime Debugger version mismatch”
int value = Fib(30);
int Fib(int n)
{
return n < 2 ? 1 : Fib(n - 1) + Fib(n - 2);
}
Android真机上大概有会0.3-0.4秒的差距
ArgumentException: The value '1' is not of type 'System.Int32' and cannot be used in this generic collection.
Parameter name: key
System.Collections.Generic.Dictionary`2[TKey,TValue].System.Collections.IDictionary.Add (System.Object key, System.Object value) (at :0)
LitJson.JsonMapper.ReadValue (System.Type inst_type, LitJson.JsonReader reader) (at Assets/ILKit/Code/BDFramework/github/LitJson/JsonMapper.cs:501)
LitJson.JsonMapper.ToObject[T] (System.String json) (at Assets/ILKit/Code/BDFramework/github/LitJson/JsonMapper.cs:931)
SerializeTool.FromJson[T] (System.String json) (at Assets/StudyPlay/ScriptsIL/Tool/SerializeTool.cs:25)
FBPolyhoneLevelDataControl.InitTxtData () (at Assets/StudyPlay/ScriptsIL/Database/Data/FBPolyhoneLevelDataControl.cs:26)
DataControlMgr.FnDataControlAttributeInit () (at Assets/StudyPlay/ScriptsIL/Database/DataControlMgr.cs:76)
DataControlMgr..ctor () (at Assets/StudyPlay/ScriptsIL/Database/DataControlMgr.cs:25)
Eagle.FnInit () (at Assets/StudyPlay/ScriptsIL/Tool/Eagle.cs:27)
GameLogic.Awake () (at Assets/StudyPlay/ScriptsIL/Manager/GameLogic.cs:67)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.