Question about Update methods

In this course (so far), only Update is being used in the StateMachine. Isn’t it better practice to include all of the Update methods provided by Unity such as FixedUpdate, and LateUpdate? In which case I suppose there should be 3 Tick methods, e.g. Tick, FixedTick, LateTick. Is this correct or is it better to just have the one method, as it is now?

You can go down that path, it depends on how complex/ how much control you want in the state machine. Something to consider: Every feature you add creates potential overhead.

1 Like

I would argue only if you really need them. So far, at least, Nathan hasn’t introduced anything that would be better suited for a FixedUpdate or LateUpdate. One of the points of not making the State() derive from a MonoBehaviour is to remove much of the overhead that normally associated with a MonoBehaviour.

Remember, if you do add these callbacks, you need to implement them in every child of State.

1 Like

Oh okay, yes I think I understand better.

How about in the case of using a Rigidbody instead of a CharacterController? Would it make sense to add a FixedUpdate here for the movement/physics calculations or would that be more work than its worth in this case?

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms