Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
334 views
in Technique[技术] by (71.8m points)

c# - 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.

question from:https://stackoverflow.com/questions/65891733/unity-fixedupdate-for-non-physics-game-logic

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...