Not a Bug

Life cycle changes

nathanliu 1 year ago updated by Lazlo Bonin (Lead Developer) 1 year ago 3

When I imported the officially released package into the project, then I printed some debugging information about the life cycle.

It is obvious that the script has a priority execution order over Bolt.

But when I deleted the files or folders other than the Assets and ProjectSettings folders in the project directory and reopened the project, we can see that the life cycle has changed. Now Bolt has a priority order of execution over scripts.

This can cause some problems if I perform some initialization operations in the script. I don't know if this is a bug or not, I only describe the problems I found.

Bolt Version:
Unity Version:
Unity 2018.4.18
Scripting Backend:
.NET Version (API Compatibility Level):
.NET 4.x
Bolt 2

In Unity theres no guarantee that one Start will run after another, and the same goes for any other event.  If your example showed Bolt's Update going before a Script's Start, then I would say the behavior is off, but from what I see above, it seems in line with the Unity standard.

Bolt doesn't have an Awake, but you can use OnEnable if you need initialization settings in a bolt script before Start.

Thank you for your answer.

Not a Bug

Hi Nathan,

This is indeed not a Bolt bug, but rather just a design quirk of Unity.

Script execution order is not deterministic / guaranteed by default.

If you want to ensure a specific script execution order, use the Script Execution Order panel of your Project Settings. There, you can put Bolt Component above or below your custom MonoBehaviour scripts.

Note that because of how Bolt is integrated into Unity, there is unfortunately no way at the moment to manually override script execution order between Bolt classes. They will all have the same order, that of "Bolt Component".