Skip to main content

Build workflow

Editor (Mono) Play does not need per-type C# Wrap; before shipping an Il2Cpp Player you must finish Generate and Lua sync. Semantics follow Editor vs Player.

Pre-release checklist

StepWhat to do
1Install is done (local libil2cpp / Lua / zlua tree exists)
2Menu ZLua/Generate/All (generates C++ stubs, not C# Wrap)
3Sync LuaScripts to StreamingAssets/LuaScripts/*.lua.txt
4Build Settings → Il2Cpp → target platform
5Device / package smoke: Initialize, interop, do not use deprecated Event APIs

Generate

  • Menu: ZLua/Generate/All
  • Depends on: local Install tree already present
  • Effect: generates Il2Cpp bridge stubs; re-run after changing public APIs or switching Lua series
  • Day-to-day Editor iteration does not require Generate every time

Sync Lua to StreamingAssets

The Player-side loader reads StreamingAssets, not the project-root LuaScripts.

  1. Copy Demo’s SyncLuaScriptsToStreamingAssets.cs into Assets/Editor/
  2. It runs automatically before build via IPreprocessBuildWithReport; or use menu Tools → Sync LuaScripts To StreamingAssets
  3. Convention: appStreamingAssets/LuaScripts/app.lua.txt (.txt avoids import conflicts)

Submodule paths may use dots: battle.aiLuaScripts/battle/ai.lua (loader uses module.Replace('.', '/')). Details: C# calling Lua · Module loading.

Editor vs Player (differences only)

Editor (Mono)Player (Il2Cpp)
Lua-visible semanticsSame as PlayerSame as Editor
ImplementationExpression Emit, etc.C++ stub + native
GenerateNot requiredRequired
Script pathsLuaScripts/*.luaStreamingAssets/.../*.lua.txt

Use Player for performance comparisons.

Common failures

SymptomFix
Prompted that Install is missingInstall first
No Lua output on Player / module not foundSync missing or wrong path/extension
Editor OK, Player crashesGenerate missing; or deprecated Event sugar still in use
Broken after Unity / Lua version changeRe-run Install → Generate

Learning path

PreviousInit & minimal interop
NextEmmyLua debugger