FirstGearGames / FishNet

FishNet: Unity Networking Evolved.
Other
1.36k stars 146 forks source link

Rigidbodies Stop Syncing After Despawning a Remote Client-Owned Predicted Object #354

Closed LiamBoog closed 1 year ago

LiamBoog commented 1 year ago

Unity version: 2021.3.3f1 Fish-Networking version: 3.4.3

Describe the bug When using a predicted Rigidbody2D-based movement controller, if an owned NetworkObject with the controller is despawned, predicted objects owned by other players stop being updated (i.e., they fly off with whatever velocity they had before the despawn) for that client. This only happens when the client whose object is despawned is a remote client (i.e., not the host). This doesn't happen if the prediction type is changed to "other" and a NetworkTransform is attached to the predicted object.

To Reproduce Steps to reproduce the behavior:

  1. Create an object with a physics-based movement controller and PredictedObejct component
  2. Set prediction type to RigidBody2D
  3. Connect at least 2 clients to server (at least one not as host) and give each ownership of previously created object
  4. Despawn the object owned by the remote host

Expected behavior Despawned object should disappear and no longer be controllable by the client. All other clients' objects should continue to have their positions/velocities/etc. updated just like before the despawn.

Screenshots If applicable, add screenshots to help explain your problem.

kylezimmerman commented 1 year ago

I have also seen this behaviour with my project. It was previously working on version 2.2.5, this behaviour started at some point between 2.2.5 and 3.5.8 (sorry I can't be any more specific, I hadn't updated in a while).

FirstGearGames commented 1 year ago

Please see this... https://fish-networking.gitbook.io/docs/manual/guides/client-side-prediction/limitations-and-gotchas#client-side-predicting-multiple-objects

kylezimmerman commented 1 year ago

I don't see anything on that page seems related to this behaviour, and it worked as expected in 2.2.5. Maybe I'm just missing something?

This isn't about 1 client controlling multiple objects, it's about other clients objects not syncing when you don't have a predicted object you own yourself.

kylezimmerman commented 1 year ago

Ah, that link was partway down the page and there is a section above it that mentions it: https://fish-networking.gitbook.io/docs/manual/guides/client-side-prediction/limitations-and-gotchas#predicting-rigidbodies-without-an-owned-object.

Is this something that will change in Prediction V2?

FirstGearGames commented 1 year ago

I just made the article in response to your report so some may need to refresh to see it.

And correct, this limitation is not present in v2.