"Working Dir Rework" has landed in the private repo (also submitted to the Asset Store). You are now able to keep all your scripts under `{ProjectDir}/OneJS`. And the scripts will be automatically bundled into`{persistentDataPath}/OneJS` for Standalone builds. Docs here have been updated accordingly.

New features and bug fixes will land in the private github repo before becoming available on the Asset Store. To request access, please send an email or pm Singtaa#4915 on Discord with your Github username and OneJS Order/INV number.


The ScriptEngine component is the core of OneJS. It manages interop between C# and JS (via Jint) and provides the DOM implementations needed by Preact. Below are the settings you can set on the component, divided into 3 categories: Interop, Assets, and Security.


Settings under Interop are generally about what features from C#/.Net you want to expose to Javascript.

  • Assemblies: List of Assembly names you want to access from Javascript. (i.e. "UnityEngine.CoreModule" and "Unity.Mathematics")
  • Extensions: List of Extension names you want to access from Javascript. (i.e. "UnityEngine.UIElements.PointerCaptureHelper")
  • Namespaces: You can map C# namespaces to JS module here. (i.e. "UnityEngine.UIElements" => "UnityEngine/UIElements")
  • Static Classes: Map C# static classes to JS module. (i.e. "Unity.Mathematics.math" => "math")
  • Objects: Map a MonoBehaviour component to JS module. Note you can drag a Component to the slot, but you can probably only do so by locking the ScriptEngine Inspector and opening a new Inspector Tab for the target MonoBahaviour. (i.e. "MaterialManager" => "matman")


The settings under Assets mostly contain templates or default files for OneJS to use, such as tsconfig.json and settings.json. So You don't really need to touch any of that. The only thing you may want to add are the Style Sheets (USS).


ScriptEngine provides the following security settings for you to set in the Inspector.

  • Allow Reflection
  • Allow GetType()
  • Memory Limit
  • Timeout
  • Recursion Depth

These are some of the security settings exposed directly from Jint. To set more granular security measures such as Member Accessor & TypeResolver, you can do so during the OnPostInit event (refer to the event API below).

ScriptEngine APIs

ScriptEngine exposes some public APIs for you to use from code.


public Engine JintEngine; // Internal Jint Engine

public Dom DocumentBody; // Dom for document.body


public event Action OnPostInit; // Happens after every ScriptEngine reload

public event Action OnReload; // Happens when ScriptEngine is just about to reload


public void RunScript(string scriptPath); // Run a script as is

public void ReloadAndRunScript(string scriptPath); // Reloads the ScriptEngine and then run a script

public void RegisterReloadHandler(Action handler); // Sub to the OnReload event and will automatically unsub during reload. Useful for the Live Reload workflow