简体   繁体   中英

Unity - FixedUpdate for non physics game logic

I'm working on a poker site in Unity 3d and have come to the point of game logic for the poker games. This includes waiting for players to act.

I am writing the server logic in a separate unity project, since it will be a client server application.

Which is better for performance?

  1. Using Async Await Sleep methods?
  2. Using either FixedUpdate or Update with a timestamp + time?

The problem for sleep methods is the players can act before the time is up, and the game has to update before the actual sleep method runs out.

For my second question. FixedUpdate says it handles physics logic and updates. Would this update handle my poker game logic?

I don't want to be wait for frame updates since I am not sure on the FPS of the server. So I assume the way to go is using FixedUpdate.

I think using FixedUpdate for physics is more appropriate because async for physics is problematic and FixedUpdate should fit for you, even if it has an small impact on performance. It's alwas good to not multithread physics, but I don't exactly know if unity makes changes in this, but FixedUpdate is safer to use in this case.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM