ME FIRST GAMES
Menu
games for me and you
![]() Understanding the flow of a MonoBehavior's life is important to writing great code. 📌 Awake: Init method called during Instantiation. This is a great place to initialize yourself and to cache references to components. This won't be called until the GameObject and Component become active for the first time. 📌 OnEnable: Init method called every-time the GameObject and Script is enabled from an off state. Subscribe to events or reset yourself here; use OnDisable as a corresponding cleanup. 📌 Start: Init method called after Awake is called on all enabled GameObjects. This is a great place init and interact with other components since Awake has already been called them. 📌 FixedUpdate: Called for each fixed-step in the physics loop. This may be called zero, once, or twice per frame update depending on the Fixed Timestep value in your project settings. 📌 Update: Called once per frame. This is a great place to constantly check something or poll input. The delta time between Update calls can fluctuate greatly depending on your framerate. 📌 LateUpdate: Called after all Update calls and right before the rendering lifecycle. This is a good place for camera controls since you know the player's position is already updated. 📌 OnDestroy: Called when the GameObject or Component is being destroyed and a great place to clean up non-scoped subscriptions. The normal Destroy call does not fire this immediately. 📌 Script Execution Order: Set the call order on scripts in your project settings. Instead of relying on Awake and Start, You can set the order of Player script to always be called before Camera script. This means, in the Camera Awake method, you know that Awake on Player was already called.
0 Comments
Leave a Reply. |
Me First Games is an independent game studio dedicated to creating unique and bizarre video games.
Red MatterStar Impact is an upcoming adventure platformer coming to PC, Mac, and Linux.
Archives
April 2021
Categories |
Copyright (c) 2020 Me First LLC
|