FishNet icon indicating copy to clipboard operation
FishNet copied to clipboard

Incorrect invocation of NetworkBehaviour.OnStop<X> on Host

Open cameronoltmann opened this issue 1 year ago • 0 comments

Important

If General, Description, and Replication are not completed the issue will be closed immediately.

General Unity version: 2023.1.10f1 Fish-Networking version: 4.2.0 Pro (Saw it for the first time in 4.1.4) Discord link: https://discord.com/channels/424284635074134018/1229607600316747847

Description Incorrect invocation of NetworkBehaviour.OnStop<X> on Host.

If Nob is despawned via Destroy():

  • All three OnStop callbacks execute, in incorrect order (OnStopServer->OnStopNetwork->OnStopClient)

If Nob is despawned via Despawn():

  • OnStopServer is called. OnStopClient and OnStopNetwork aren't called until the next frame.
  • If Destroyed before the next frame, OnStopClient and OnStopNetwork are not invoked.

Replication Steps to reproduce the behavior:

  • Import attached package and start included scene
  • Start server and client
  • Click Spawn
  • Notice two cubes in scene
  • Click Despawn
  • Notice cubes disappear, and the following logs show: image [Nullrefs are caused by the Despawn-then-Destroy NetworkBehaviour not unregistering from TimeManager.OnTick]

Expected behavior Objects both despawn, invoking OnStopServer, OnStopClient, OnStopNetwork in order, and correctly unsubscribing from TimeManager.OnTick.

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

OnStopCallbackTest.zip

cameronoltmann avatar Apr 18 '24 03:04 cameronoltmann