So 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 the scene stays the same).
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: http://docs.unity3d.com/Manual/scriptsinassetbundles.html, and this works perfectly in the WebPlayer. In webGL however, which is the requirement for our project, it 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);” (as seen in the example), so I suppose the Reflection class is not (yet?) fully supported for WebGL.
So my question is - 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.
Thanks in advance