U3D开发中关于脚本方面的限制-有关IOS反射和JIT的支持问题
U3D文档中说明了,反射在IOS是支持的,除了system.reflection.emit空间内的,其它都支持。JIT是不支持的。
本质上来说即是:只要不在运行时动态生成代码的行为都支持,reflection.emit下的功能可以动态的生成代码(生成程序集,生成类,生成函数,生成类型等,是真正的生成代码),JIT也能动态的生成代码(如C#生成的IL在各平台上运行时可以由JIT编译成汇编语言)。
其它的并不会生成代码的反射功能是可以用的,如 type.gettype, getfield, Activator.CreateInstance
文档如下:
Scripting restrictions
We strive to provide a common scripting API and experience across all platforms Unity supports. However, some platforms have inherent restrictions. To help you understand these restrictions and support cross-platform code, the following table describes which restrictions apply to each platform and scripting backend:
| Platform | Scripting Backend | Restrictions |
|---|---|---|
| Standalone | Mono | None |
| WebGL | IL2CPP | Ahead-of-time compile, No threads |
| iOS | IL2CPP | Ahead-of-time compile |
| Android | <

在Unity3D(U3D)的iOS开发中,由于平台限制,反射支持有限,不包括System.Reflection.Emit空间内的功能。JIT编译也不被支持。开发者需要在编译时生成所有代码,以确保AOT(预编译)兼容。反射的某些功能如获取类型、字段和创建实例仍然是可用的。同时,AOT平台可能因反射导致序列化和反序列化问题,而泛型虚拟方法可能引发运行时错误。此外,iOS不支持使用System.Threading命名空间的多线程操作。
最低0.47元/天 解锁文章
7332

被折叠的 条评论
为什么被折叠?



