Use /collab in Discord for private repo access to early features and fixes not yet available on the Asset Store. OneJS V2 is in preview on branch onejs-v2: better performance, zero-allocation interop, and new esbuild workflow. A portion of the v2.0 doc is currently available, but it is still a work in progress.
VERSION
Doc Menu

Deployment

The Bundler component (on ScriptEngine) takes care of bundling your scripts at buildtime and extracting the bundle during runtime.

You can configure where your scripts should reside under ScriptEngine's MISC section (via the Editor & Player WorkingDir properties).

The bundling and extraction process is fairly automatic so you don't need to worry about it too much.

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:

XML
<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>

Folks tend to run into problems when dealing with link.xml for the first time. So here are some tips.

  • The file name has to be link.xml, not linker.xml or links.xml.
  • Make sure the extension is .xml and not something like .xml.txt.
  • The root xml node has to be named <linker>.