Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Question [Fishnet] Replacement or fix for WaitForFixedUpdate()?

Discussion in 'Multiplayer' started by ATMLVE, Mar 12, 2024.



    Jun 11, 2023
    I asked on discord as well as searched and found someone else with this question, I haven't seen an answer yet. It's a bit obscure.

    I have coroutines I use for some procedural generation, they rely on things being generated successively which use some colliders for detection. This generation is nonfunctional without WaitForFixedUpdate() within the coroutine, because the code can execute faster than colliders can be placed and then picked up by the code. Putting the Wait in there was the resolution before.

    Now with Fishnet's time manager running my physics, this Wait method doesn't work the same or at all anymore. A little bandaid was just to put a WaitForSeconds(0.01f) in there which works but gives me the oogie boogies, it feels like an invitation for rare and sinister bugs to cause me hours of headache later down the line when I've long forgotten my current code. Not only that but it's slower, although actually it shouldn't be but I realized recently the WaitForFixedUpdate which I kept in IS actually causing some delay but not the way I expect it to, but FixedUpdate apparently runs at .02 seconds, but also my TimeManager tickrate is 60 which amounts to .01 again...

    I'm hoping the answer is a simple one, I wanted a thread in case someone else searches for this later on like I did. Maybe there's more to it than this, maybe it should be working fine and it's a bug.

    For reference, my TimeManager runs at 60 ticks currently.
  2. Punfish


    Dec 7, 2014
    If using time manager for your physics timing with most people do fixedupdate will not call, as I'm sure you've come to realize. You can wait frames and check if TimeManager.FrameTicked as one option.
    ATMLVE likes this.