Closed theWill closed 4 years ago
EDIT - hmmm, actually fixedUpdate might not actually fire less than update upon researching it. We could do locking on some variable so the update loop doesnt execute multiple times in a row.
One other thing I haven't done. I think we should move all the logic from Update() to FixedUpdate(). You can notice that the update() loop fires so quickly that it actually does multiple updates to the pings. You cool with that? @phalasz
I think adding an extra second or so randomness to the timers should fix that, so it could fire as many updates, but only ping the servers when the next update time comes.
I am closing this. I ended up reverting to mostly use your code due to issues I had after further testing. Thanks for humoring me at the time. @phalasz
Other changes:
Removed initial call to UpdateItem and just made the next tick really soon after creating the server entry as the old behavior would show new servers as disconnected for the first 5 seconds (maybe data wasn't in yet?).
made some things public like the list of servers and made serializable. Allows visibility in the inspector as to what is going on.