Loading...

Logo
DocumentationBehaviorsCustomFrame Event
Custom

Frame Event

Last updated March 1, 2023

Description

The Frame Event behavior triggers an event when a specified frame event occurs. This behavior allows for frame-perfect executions.

Properties

Triggers Once on Event

Event

Select an event for the behavior to listen for.

  • On Update - Trigger an event every time a frame is drawn to the screen. Note that this relies on framerate, so do not rely on this as a reference of time.
  • On Fixed Update - Trigger an event 60 times per in-game second. Unlike the On Update event, this event will always trigger at the same rate regardless of performance meaning the delta time will always be consistent.
  • On Pause - Trigger an event on the frame where the game is paused via pressing the hamburger icon. On exported projects, this event will never trigger.
  • On Resume - Trigger an event on the frame where the game is no longer paused via pressing the resume button in the Debug menu. On exported projects, this event will never trigger.
  • On Scene Start - Trigger an event before the first frame of the running scene. There will be an option to trigger again on scene restart. This is useful for setting up things before the project starts running.
  • On Object Spawn - Trigger an event when the object has been spawned during runtime. This does not trigger when the scene starts.
  • On Object Destroy - Trigger an event when the object has been destroyed during runtime.
  • On Object Enable - Trigger an event when the object has been enabled during runtime.
  • On Object Disable - Trigger an event when the object has been disabled during runtime.

Outputs

Delta Time

This behavior outputs delta time for the On Update and On Fixed Update frame events. The delta time is the amount of time passed between the previous frame and the current frame in seconds.

Examples

  • You can recalculate an object's position every frame using the On Update event.
  • You can trigger a cutscene for the first time the scene runs using the On Scene Start event and disabling the Triggers on Restart toggle.
  • When the player pauses the project, their in-game progress can automatically save via the Modify Save File behavior. You can trigger this to happen On Pause event.

Receive Message