Deployment
When building standalone apps, the scripts from {ProjectDir}/OneJS
will be automatically bundled up and be extracted to {persistentDataPath}/OneJS
at runtime.
This process is fairly automatic so you don't need to worry about it too much. But here's a bit more info. The OneJSBuildProcessor
ScriptableObject hooks into your build process and zips up all the scripts under {ProjectDir}/OneJS
. The Bundler component (on ScriptEngine) takes care of extracting the zip during runtime.
Live Reload, on or off
For production deployment where you don't need Live Reload, remember to turn it off by unchecking the "Turn On For Standalone" option on the Live Reload component. By default, this option is on because during development you may still find Live Reload useful for Standalone builds/apps.
link.xml for AOT Platforms and IL2CPP
AOT Platforms and IL2CPP builds will strip all your unused C# code. So for all the classes you'd like to call dynamically from Javascript, you'd need to preserve them. link.xml will do the job. Here's an example:
<linker>
<assembly fullname="mscorlib" preserve="all" />
<assembly fullname="OneJS" preserve="all" />
<assembly fullname="UnityEngine.CoreModule" preserve="all" />
<assembly fullname="UnityEngine.PhysicsModule" preserve="all" />
<assembly fullname="UnityEngine.TextRenderingModule" preserve="all" />
<assembly fullname="UnityEngine.UIElementsModule" preserve="all" />
<assembly fullname="UnityEngine.IMGUIModule" preserve="all" />
<assembly fullname="Unity.Mathematics" preserve="all" />
</linker>