I'm working on a project that uses Unity WebGL to display different machines/parts/.. in 3D, these parts or machines are selected by the user and then loaded into a scene (for now there is just a single scene, but we might want to load scenes dynamically also).
Because of the large amount of choices we want to create different asset bundles, containing 1 or more parts each, so we can download these on-demand.
I've done this successfully by passing the URL to LoadFromCacheOrDownload
and extracting the gameObject from the www object.
Now we would also like to include scripts with the assets to create animations and user interaction. I followed the explanation given here: docs.unity3d link, and this works perfectly in the WebPlayer. However the end requirement is WebGL, and the same code built for WebGL gives the following error:
NotSupportedException: /Users/builduser/buildslave/unity/build/Tools/il2cpp/il2cpp/libil2cpp/icalls/mscorlib/System/AppDomain.cpp(184) : Unsupported internal call for IL2CPP:AppDomain::LoadAssemblyRaw - "This icall is not supported by il2cpp." System.AppDomain.LoadAssemblyRaw (System.Byte[] rawAssembly, System.Byte[] rawSymbolStore, System.Security.Policy.Evidence securityEvidence, Boolean refonly) System.AppDomain.Load (System.Byte[] rawAssembly, System.Byte[] rawSymbolStore, System.Security.Policy.Evidence securityEvidence, Boolean refonly) System.AppDomain.Load (System.Byte[] rawAssembly, System.Byte[] rawSymbolStore, System.Security.Policy.Evidence securityEvidence) System.AppDomain.Load (System.Byte[] rawAssembly) System.Reflection.Assembly.Load (System.Byte[] rawAssembly) API+c__Iterator0.MoveNext ()
It seems to stem from the call System.Reflection.Assembly.Load(txt.bytes);
(which I got from the example), so I suppose the Reflection class is not (yet?) fully supported for WebGL. I can't seem to find any documentation on this.
Is there a way around using Reflection for this? At best I'm hoping for some different code that can fix this, at worst that we will have to create the scripts for WebGL in Javascript and add them as such instead of as a binary? I'm a bit lost here so any leads are appreciated.
(Cross-posted from answers.unity3d)