Every game object behavior in Prowl is driven by a predictable sequence of lifecycle callbacks. When you create a class that extendsDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/ProwlEngine/Prowl/llms.txt
Use this file to discover all available pages before exploring further.
MonoBehaviour, the engine automatically calls these virtual methods at precisely defined moments — from the instant the component is loaded into memory, through every frame of gameplay, all the way to when the object is destroyed. Understanding this order, and knowing which callback is the right tool for each job, is the foundation of writing reliable, bug-free game logic.
The Lifecycle at a Glance
The table below maps each callback to the moment it fires and what you should use it for.| Method | When Called | Typical Use |
|---|---|---|
Awake() | Once, when the component is first loaded (even if disabled) | Initialize private state, cache component references |
OnEnable() | Each time the component or its GameObject becomes active | Subscribe to events, reset runtime state |
Start() | Once, just before the first frame the component runs | Cross-component setup after all Awakes have run |
FixedUpdate() | Every physics timestep (Time.fixedDeltaTime) | Physics forces, deterministic simulation |
Update() | Every rendered frame | Input reading, game logic, AI |
LateUpdate() | Every frame, after all Update() calls finish | Camera follow, IK, depend-on-update logic |
OnLevelWasLoaded() | When a new scene finishes loading | Reinitialize scene-dependent state |
OnDisable() | Each time the component or its GameObject becomes inactive | Unsubscribe from events, pause state |
OnDestroy() | When the component is permanently removed | Final cleanup, releasing unmanaged resources |
Awake() fires even if the component starts disabled. Start() fires only when the component is enabled and about to tick for the first time. Use this distinction deliberately.Initialization Methods
Awake
Awake() is called exactly once when the engine loads your component, regardless of whether it is enabled. Use it to initialize private fields and cache references to components on the same GameObject — it is safe because all GameObjects in the scene are guaranteed to exist, but Start() has not yet run on any of them.
OnEnable and OnDisable
These are called every time the enabled state changes, not just on creation. If your component subscribes to events,OnEnable / OnDisable is the correct place to manage those subscriptions so you avoid memory leaks.
Start
Start() runs just before the component’s first Update(), and crucially, after all Awake calls in the scene have completed. This makes it the right place to query references to components on other GameObjects, since every object has finished its Awake() by this point.
Frame-Loop Methods
Update
Update() is the primary per-frame callback. Frame duration varies, so always multiply movement values by Time.deltaTimeF to keep behavior frame-rate independent.
LateUpdate
LateUpdate() fires after every Update() in the scene has been called for that frame. Use it whenever your logic depends on a value that another component sets during Update() — the canonical example is a follow camera.
FixedUpdate
FixedUpdate() runs at a fixed interval governed by the physics engine (Time.fixedDeltaTime = 1.0 / PhysicsSettings.TargetFrameRate). Apply physics forces and other deterministic simulation logic here — never in Update().
Destruction Callbacks
OnDestroy
OnDestroy() is called when the component is permanently removed — either because the GameObject is destroyed or RemoveSelf() is called. Use it for final cleanup of anything OnDisable is not sufficient for (e.g., releasing native handles).
Scene Loading
OnLevelWasLoaded() is called on every active MonoBehaviour whenever a new scene finishes loading. Use it to reinitialize any state that depends on scene contents.
Camera Hooks
These methods are called on components attached to the same GameObject as aCamera component (or any camera that calls the render loop).
OnPreCull(Camera)
Called right before the camera determines which objects are visible. Ideal for toggling renderer states before culling.
OnPreRender(Camera)
Called after culling but before any geometry is drawn. Use it to set shader globals or configure render state.
OnPostRender(Camera)
Called after all scene geometry has been drawn to the camera’s target. Use it to draw overlays.
OnRenderImage(RenderTexture, RenderTexture)
Full-screen image-effect callback. Blit
src to dest with a material to apply post-processing.[ImageEffectOpaque] to run OnRenderImage after opaque geometry but before transparency, and [ImageEffectAllowedInSceneView] to also apply it in the editor viewport.
Immediate-Mode UI
OnGUI(Gui gui) is called each frame on any camera with a GUILayer component active. Use it to draw runtime HUDs with Prowl’s immediate-mode GUI system.
Editor Gizmos
DrawGizmos() and DrawGizmosSelected() are editor-only callbacks for visualizing data in the Scene view. They are never called in a standalone build.
Controlling Execution Order
By default, the order in which MonoBehaviours update is not guaranteed. Use[ExecutionOrder(int)] to set an explicit priority — lower numbers update first.
[ExecuteAlways] to run lifecycle methods in the editor even when the game is not playing — useful for procedural generation or live previews.
Full Lifecycle Order Reference
OnEnable()
Called immediately after Awake if the component is enabled, or whenever it becomes enabled later.
Start()
Called before the first Update, after all Awake calls in the scene. Safe for cross-component references.
FixedUpdate()
Physics timestep. May fire multiple times per rendered frame, or not at all, depending on frame timing.