Skip to content

Commit 0282657

Browse files
committed
Add a note about static variable behaviour in editor
1 parent ca4c0c8 commit 0282657

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

manual/scripting/csharp/restrictions.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ Flax tries to implement all the engine features and scripting APIs across all su
1414
- System.Reflection.Metadata.dll
1515
- System.Web.Extensions.Design.dll
1616

17+
## Static variables in editor
18+
19+
Static variables may behave differently when running the scripts in editor compared to running the cooked game. The static variables are usually initialized when the scripting assemblies are loaded and used for the first time, but Flax Editor may not always reload the assemblies between runs (unless recompilation is needed), so the values from previous runs are retained. There are many ways to work around this by using [Game Plugins](../plugins/index.md) to manage state or subscribing to `FlaxEditor.Editor.Instance.PlayModeBeginning` event which is called right before entering play mode.
20+
1721
## Ahead-of-time compile
1822

1923
Ahead-of-time (**AOT**) compile is a technique used to precompile all the managed code during game building process instead of using just-in-time (**JIT**) compilation on the target device. That's because some platforms do not allow runtime code generation. In most cases this has no effect on game scripting but in a few specific cases, AOT platforms require additional consideration.

0 commit comments

Comments
 (0)