Skip to content

LateUpdate

MainManager.LateUpdate is a very large update events, just like its Update counterpart. However, where it differs is Update is mainly concerned about inputs and UI naviguation updates while LateUpdate handles a lot of diverse update tasks. Most of its updates impacts visual with some state consistency logic. Most of the method requires basicload to be true meaning LoadEverything completed.

Here's what happens during LateUpdate:

  • messagebreak (the default linebreak of SetText mostly used in dialogue mode) is set 10.5 unless languageid is undefined or 0 (English) where it's 9.75 instead
  • itemdescbreak (the default linebreak of SetText mostly used when rendering items's description box) is set 9.9 unless languageid is undefined or 0 (English) where it's 10.5 instead
  • framestep is set to TieFramerate(1.0). This is a convenient, but partially out of date field to get number that scales with the smoothed average framerate based on 60 FPS (meaning 1.0 is equivalent to exactly 60 FPS). It's partially out of date because it's only updated on LateUpdate, but in practice, because TieFramerate is based on smoothDeltaTime, the variation should be minimal
  • At this point, the method returns abrutply if basicload is false which means LoadEverything isn't done yet
  • UpdateOutlines is called which sets the GlobalOutline global Shader float to the value that reflects the outlines setting
  • GUICamera angles are reset to Vector3.zero
  • globalcamdir has its angles reset to (0.0, MainCamera y angle, 0.0). For more information, check the camera system documentation
  • globalcooldown decreases by TieFramerate(1.0)
  • If playerdata isn't null or empty, RefreshHUD and RefreshDiscovery are called
  • If a texttail exists, the tailtarget gets updated
  • If started is false (this is the first LateUpdate since boot) and player exists (meaning the game isn't loading a map), DetectIgnoreSphere is called on player.entity and started is set to true
  • If the game is inevent, but not inbattle, both letterbox elements has their color set to a lerp from the existing color to Color.black with a factor of TieFramerate(0.15)
  • inputcooldown is decreased by framestep
  • If the switchicon exists, its color is set to a lerp from the existing color to Color.clear with a factor of TieFramerate(0.01)
  • stickholdx is updated such that it is true if the absolute value of InputIO.JoyStick(0) and InputIO.JoyStick(2) (the horizontal axises inputs) are below 0.5 indicating that neither axises have a held input on this frame
  • stickholdy is updated such that it is true if the absolute value of InputIO.JoyStick(1) and InputIO.JoyStick(3) (the vertical axises inputs) are below 0.5 indicating that neither axises have a held input on this frame
  • Some constraints on max numbers are enforced on 2 flagvar:
    • 26 (berry bank balance): Set to 10000 if it is higher
    • 27 (game token count): Set to 9999 if it is higher
  • For any completed boardquests, they are removed from the open and taken boardquests
  • If partylevel is 27 (the max one), partyexp is set to neededexp (this essentially makes the EXP counter looks like X/X where X was the neededexp value set when rank 26 was reached)