0
Under review

On first (late) update trigger

Einar 5 months ago in Game Creator updated by Marti (Lead Developer) 4 months ago 2

The "On Start"-trigger fires in some cases too early. For instance, I wanted my character to start the game holding an item using the hand IK action, but since the necessary parts of this interaction is setup in the first Update call (in CharacterAnimator.cs) it just silently ignored the call when using the On Start trigger. Furthermore, when I tried calling it on the first frame of the game, it still did nothing because the Update of the CharacterAnimator just happened to be called later than the update of my trigger.

So I propose a trigger/igniter that fires once, on the first LateUpdate(). This ensures that any setup that needs to be done in the first Update() is finished, no matter where or why.

Unity version:
Game Creator version:
+1

Attached is the Igniter I've made for myself for various update trigger scenarios. It's maybe a bit too low-level or unfocused for the core Game Creator library, but as a trigger for custom actions and quick prototyping I've found it useful. It will be called on one of the chosen updates (Update, FixedUpdate, LateUpdate). It can either run only once or it can be set to repeat infinitely. Lastly, it can have a delay before it is executed (with repeat it will then be executed after each interval).


Custom_OnUpdateIgniter.cs

Under review

I wouldn't want to add this as part of the core, since it's something that is at the edge between a hack and a feature. However, it might also be useful to add an Action that waits for a single frame. That way, you could use the "On Start", use the action to wait for a single frame (so all other systems get initialized).

I try to keep the same nomenclature as Unity, but on the other hand, a LateStart might proof useful. I'll think this further. Thanks!