Despawned callback is unreliable in remote clients.

SeaberyUnity
edited July 2022 in Fusion

Has anybody experienced any unreliability with the despawned method call in NetworkObjects through the network?

In our case, we have this situation:

  • Two clients (A and B) connected in shared mode.
  • Spawn Network Objects from client A. A is owner, and objects are created in B too.
  • Request state authority (RequestStateAuthority()) for any of the objects in B.
  • Despawn the object from B.

We found that, with some frequency, the Despawned object is destroyed in B but not in A (A doesn't get its Despawned method call, nor the object is destroyed).

Our understanding is that B, as long as it has State Authority over the object, should be able to Despawn it across the network (and it usually happens in that way) but sometimes it doesn’t and thus the network session state becomes inconsistent afterwards.

The only 'exotic' thing we do is to wait till B has the authority by waiting till HasStateAuthority is true in B like this:

            var instance = FindObjectOfType<NetworkObject>();
            instance.RequestStateAuthority();
            await UniTask.WaitUntil(() => instance.HasStateAuthority);
            runner.Despawn(instance);

Somebody had issues like this or has some idea about what are we doing wrong?