OnDestroy() isServer returns false on Server Objects, Mirror-89.6.8
hikedev opened this issue · comments
I upgraded from Mirror-88.2.4 to Mirror-89.6.8. However, I encountered a behavior change that affected my project.
Issue Identified:
In the updated version (Mirror-89.6.8), when invoking the OnDestroy() method on a server object, the isServer property consistently returns false. (Mirror-88.2.4), isServer would return true under the same circumstances.
To troubleshoot, I reverted back to the previous version (Mirror-88.2.4), and the isServer property returned true again as expected.
void OnDestroy()
{
Debug.Log(isServer);
}
This could be script firing order.
isServer
in Network Behaviour (NB) is a pointer to NetworkIdentity.isServer
which has an OnDestroy
in it, which sets that to false.
If your NB's OnDestroy
is called after that, then you get false.
You can try re-ordering the components on the object, or evaluate NetworkServer.active
instead.
Thank you, NetworkServer.active might do the trick.