Possibility of runtime JIT compilation to work on every platform

I am not sure what is the roadblock about this feature. But dotnet should allow generation and loading of wasm on runtime so unity should be able to run dynamic code in webgl

Same go for other platform. There should be some way to load and run dynamic codegen in every of them. Or it is not possible at all under IL2Cpp and emscripten ?

In addition, is it possible for graph tool foundation to generate into IL and can serialized to IL codegen in runtime?

Some platforms won’t allow you to generate code at runtime. It’s not a technical limitation of the platform or the game engine but a limitation imposed by the platform owner. An excellent example of this is iOS. Apple has it in their guidelines (Section 2.5.2) that apps are not allowed to change their functionality. JIT qualifies for them.

https://developer.apple.com/app-store/review/guidelines/

What I see is ios is the only platform that explicitly restrict that. And they can’t control webgl application anyway

I’m not an expert on Wasm, but it does seems possible for it to do something like a JIT. We’ve experimented with any IL2Wasm tool that can convert IL bytecode to Wasm in the browser, then load the Wasm and execute it. But this is not something we are considering for a product.

Microsoft’s Blazor technology is maybe close to what you are thinking - I believe there the runtime is precompiled and the IL code is interpreted in the browser. We don’t have plans now to support Blazor with Unity, but it is a technology we are watching.

3 Likes

It’s not the only platform. All consoles are restricting this. That’s why, usually, the scenario of dynamically load code is not ideal to support for the reason that if you heavily rely on this, then for Mobile, it’s off, because you wouldn’t start to not support iOS, and for Consoles it’s completely off as well.

So, realistically, we cannot really support this scenario (except for desktop players) in a cross platform way or within a segment of the platforms (except desktop, which, it is working somehow)

2 Likes

Thank you for your clarification