Fast Script Reload

Are you tired of waiting for full domain-reload and script compilation every time you make a small code change?


Me too.


Tool will automatically compile only what you've changed and immediately hot-reload that into current play session.


Iterate on whatever you're working on without reentering play mode over and over again.


And you don't have to adjust your code either, just import.


Works with any code editor.


• Setup

1) Import

2) Play

3) Make Code Change

4) See results


It's that simple.


• Open Source

FSR is fully open source - available on Github, getting it on Asset Store is a huge support!


• Hot-Reload in development build (on device)

You can use add-on to this tool: Live Script Reload to create builds (Standalone / Android) which will allow you to use Hot-Reload functionality in builds. Iterate quickly on deployed Android APK / standalone windows build (exe).


• One-off custom code executions on Hot-Reload

When you need to set the stage to test your feature out.


Add following methods to changed script:


| void OnScriptHotReload()

| {

| //do whatever you want to do with access to instance via 'this'

| }


| static void OnScriptHotReloadNoInstance()

| {

| //do whatever you want to do without instance

| //useful if you've added brand new type

| //or want to simply execute some code without |any instance created.

| //Like reload scene, call test function etc

| }



• Performance

It's a development tool, you're not supposed to ship with it! :)


Your app performance won't be affected in any meaningful way though.

Biggest bit is additional memory used for your re-compiled code.

Won't be visuble unless you make 100s of changes in same play-session.


• Supports (Tested)

- Windows / Mac (Intel editor version only) / Linux

- Unity 2019.3

- Unity 2020.3

- Unity 2021.3

- Unity 2022.2


• Few things to have in mind, limitations:


* most limitations can be overcome with User Defined Script Overrides (see docs for more info)


• Generic methods and classes won't be Hot-Reloaded

Unfortunately generics will not be Hot-Reloaded, to workaround you'd need to move code to non-generic class / method.


• Creating new public methods

Hot-reload for new methods will only work with private methods (only called by changed code)


• Adding new fields (Experimental support added in 1.3)

You can now add new fields and tweak them in editor! Minor limitations:

- outside classes can not call new fields added at runtime

- new fields will only show in editor if they were already used (at least once)


• Extensive use of nested classed / structs

If your code-base contains lots of nested classes - you may see more compilation errors.


• Mac Silicon Editor version not supported

On Mac only Intel Editor version is supported. For Silicon version logs will show that everything is fine but actual change will not happen at runtime


• Other minor limitations

There are some other minor limitations, please consult full list


• Roadmap

- add Mac/Linux support - (DONE, added with 1.1)

- add debugger support for hot-reloaded scripts (DONE, added with 1.2)

- allow to add new fields (adjustable in Editor) (DONE, added with 1.3)

- editor mode support (DONE, added with 1.4)

- better compiler support to workaround limitations


• FAQ

- When importing I'm getting error: 'Unable to update following assemblies: (...)/ImmersiveVRTools.Common.Runtime.dll'

> This happens occasionally, especially on upgrade between versions. It's harmless error that'll go away on play mode.


- When upgrading between versions, eg 1.1 to 1.2 example scene cubes are pink


> This is down to reimporting 'Point' prefab. Right now plugin will make sure it's using correct shader eg. URP / Built-in but only on initial import.


To fix please go to `FastScripReload\Examples\Point\Point.prefab` and search for 'Point' shader.