2N Lightning Reload | Edit C# In Play Mode Without Compiling


New MonoBehaviours, added to live objects with AddComponent. ... YOUR DEBUGGER STAYS ATTACHED ... Breakpoints you set after a reload hit, in the method you edited and in the ones around it.


by 2NGAMES


Price History +

Edit your C# while the game is running and see it instantly, in the Editor and on Android or standalone builds. No domain reload, no lost scene state, no cloud server, no login.

SUPPORTED OPERATING SYSTEMS

Windows

macOS and Linux support is planned.


SUPPORTED UNITY VERSIONS

2021.3 LTS, 2022.3 LTS, Unity 6.0, 6.3 and 6.5, with or without domain reload on Play. Verified end to end on all five.


SUPPORTED CODE CHANGES

New classes, structs, enums, interfaces and new .cs files mid-session

Coroutines that are already running, and new Unity messages on types that did not have them

New MonoBehaviours attached to live objects

Unity Entities systems, SystemBase and ISystem (Entities 1.0 to 1.4)

Breakpoints set after a reload (Visual Studio 2022)

Undo / redo across reloads (Ctrl+Alt+Z / Ctrl+Alt+Y)

Method bodies in MonoBehaviours, plain, static and generic classes

Adding, renaming or removing methods; changing signatures, return types and accessibility

Adding, editing or removing fields (static values survive the reload)

Constructors, properties, events and indexers

Generic methods and generic classes, reference and value types

Lambdas, local functions, async/await, iterators

Exception filters (catch ... when)

Burst-compiled jobs (IJob, IJobFor, IJobParallelFor)

Operators, and methods that take or return your own structs and enums (including T? and out), in the Editor and in standalone players

Methods that call a network RPC; RPC bodies with the optional IL post-processor weave (Netcode for GameObjects)

Reload on-device (Android and standalone, Mono backend)


LIMITATIONS

IL2CPP and iOS: not supported. Live patching needs the Mono scripting backend.

A few structural edits need a Play restart, for example a changed base type, a new field on a struct or a changed Entities query. The Console names each one, with the reason.

Everything else, with the reasoning behind it, is in the README and in the Help tab of the Status Window.

Stop losing your game state to a recompile.

A normal C# recompile wipes out the runtime state you were working with: the player's position, the scene setup, the exact bug you spent ten minutes reproducing. 2N Lightning Reload patches the running methods instead. You save the file and the game keeps playing with your new code.

It works on the device too. The same edit goes straight into a running Android build or a standalone player over your local network. No rebuild, no reinstall.

Nothing to sign up for. No account, no license server, no compiler service to download. It compiles with the Roslyn that already ships inside your Unity install, so it works offline and behind a corporate firewall. Import the package, press Play, done.


WHAT YOU CAN CHANGE WHILE PLAYING

Brand-new classes, structs, enums and interfaces, even in a new .cs file you write mid-session.

Coroutines that are already running, and new Unity messages (Update, OnTriggerEnter and the rest) on types that did not have them before.

New MonoBehaviours, added to live objects with AddComponent.

Unity Entities systems, SystemBase and ISystem alike, and Burst-compiled jobs.

Method bodies: logic, values, loops, LINQ, lambdas, local functions, constructors, properties, generics.

async/await, iterators, and exception filters (catch ... when).

New methods, new fields, changed signatures, removed members.

Code around a network RPC reloads too, and the call still goes over the network. With Netcode for GameObjects, the optional IL post-processor weave can reload the RPC body itself.


YOUR DEBUGGER STAYS ATTACHED

Keep Visual Studio attached while you reload. Breakpoints you set after a reload hit, in the method you edited and in the ones around it.


BUILT FOR REAL SESSIONS

Undo / redo across reloads. Step your code back and forth without retyping anything.

A status window that shows what was patched, how long it took, and why something was refused.

[OnLightningReload] callbacks and a small public API, so you can hook it into your own tools.

Settings live in ProjectSettings, so updating the package never resets them.

A typical reload lands well under a second. Reload time scales with the assembly you edited, not with the size of the whole project.


TRY IT IN 30 SECONDS

Open Tools > 2N Lightning Reload > Status Window. Drop Samples/LightningReloadDemo.cs on any GameObject and press Play. Change a number in that script and save. The running scene updates without leaving Play mode.


REQUIREMENTS

Windows editor. Unity 2021.3 to 6.5. Mono scripting backend. On-device: Android (ARMv7 development builds) and standalone players on your local network. IL2CPP and iOS are not supported; live patching needs the Mono scripting backend.


A few changes still need a Play restart. When that happens the Console tells you which one and why. The full list is in the README.