playMaker

Author Topic: [SOLVED] Can someone explain what's the exact usage for the updates?  (Read 2586 times)

ryf9059

  • Full Member
  • ***
  • Posts: 100
Sorry for bring this up this again but I still don't exactly understand the differences between update, fixedupdate, late update and per second option in FSM
Jean mentioned it in this link: http://hutonggames.com/playmakerforum/index.php?topic=4081.0 but I'm still confused about the exact usage. Since as Jean said this is a misleading naming :(

Can someone explain what are those things for and which case are they used? Also in what case should those option be combined? What's the realtionship with deltaTime?

Thanks
« Last Edit: June 10, 2013, 08:06:32 AM by ryf9059 »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Can someone explain what's the exact usage for the updates?
« Reply #1 on: June 10, 2013, 02:42:17 AM »
Hi,

 the doc I think explains it well enough:

http://docs.unity3d.com/Documentation/ScriptReference/MonoBehaviour.Update.html

http://docs.unity3d.com/Documentation/ScriptReference/MonoBehaviour.LateUpdate.html

http://docs.unity3d.com/Documentation/ScriptReference/MonoBehaviour.FixedUpdate.html

so in short:

-- Update is your first stop for general usage.

-- When you want to follow objects around, Late Udpdate it likely better and will prevent jittering.

-- To control physics objects, use fixedUpdate.

these 3 calls happens within a "frame", and between two frames, the time elapsed can vary, so to DeltaTime is here to tell you how much time has passed since the last frame, and thus allow to create frame rate independant behavior.

http://docs.unity3d.com/Documentation/ScriptReference/Time-deltaTime.html?from=MonoBehaviour


Bye,

 Jean

ryf9059

  • Full Member
  • ***
  • Posts: 100
Re: Can someone explain what's the exact usage for the updates?
« Reply #2 on: June 10, 2013, 05:47:47 AM »
the doc I think explains it well enough:

http://docs.unity3d.com/Documentation/ScriptReference/MonoBehaviour.Update.html

http://docs.unity3d.com/Documentation/ScriptReference/MonoBehaviour.LateUpdate.html

http://docs.unity3d.com/Documentation/ScriptReference/MonoBehaviour.FixedUpdate.html

so in short:

-- Update is your first stop for general usage.

-- When you want to follow objects around, Late Udpdate it likely better and will prevent jittering.

-- To control physics objects, use fixedUpdate.


Thanks, that explains things clearly. So only one of these update should be selected right? Also, when to combine the per second option?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Can someone explain what's the exact usage for the updates?
« Reply #3 on: June 10, 2013, 07:08:58 AM »
Hi,

 Yes, only one of these option "should" be used, it never make sense to do the same thing on Update and on Late Update for example.

the "per seconds" option in the various actions is to provide an animation system that is guaranteed to work the same regardless of the performances ( FPS fluctuations), that's all there is to it. So instead of saying:

"move the gameobject by 10 units every frame"

you actually say

"move the gameobject by 10 units every seconds"

which implies that it will be consistent and predictable.

bye,

 Jean