Is including a "Fixed Tick" method in the state machine a good idea?

Hello, I’ve recently completed the course and am using some of the concepts from it in a new project. In my new project, I am creating a state machine as well. In some of the states, actions are taken that are dependent on physics calculations. My plan is to include an abstract class in the State class called “Fixed Tick” which each State implements and is called every Fixed Update by the state machine class. This would be used for physics-based things like adding force and such. I wanted to know if it was a good approach and commonly used practice or if I would run into some issues by doing this. Thanks!

1 Like

Yes, this is exactly what I would do (and have done in the past - see here), and I believe I’ve seen a post where the esteemed @Brian_Trotter has also done the same (Ed - Found it here). Just remember to pass in Time.fixedDeltaTime instead of Time.deltaTime

1 Like

Good to know! If you and Ben have use this technique, then it must be a good practice. I stumbled into the idea after seeing some unreliable results in my build compared to what I was seeing in the editor. Adding the fixed tick and using Time.FixedDeltaTime solved my issue.

You may have me confused with a different Brian Trotter. I seldom rank esteemed.

2 Likes

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

Privacy & Terms