Subscribing to an event in ExecuteAlways

Without even trying to read the unformatted code above, when you press PLAY / STOP, Unity tears down everything in the scene, recreates it and injects what it can from serialization. This would not normally contain things you subscribe in code, but stuff you drag in in the inspector.

If you post a code snippet, ALWAYS USE CODE TAGS:

How to use code tags: Using code tags properly

1 Like