MirageNet / Mirage

Easy to use high performance Network library for Unity 3d
https://miragenet.github.io/Mirage/
MIT License
507 stars 63 forks source link

feat(ClientObjectManager): allow DestroyAllClientObjects to keep local player object #1170

Closed GeekBrony closed 7 months ago

GeekBrony commented 7 months ago

This feature is useful only in a scenario when disconnecting from one server but having their client keep the local player object spawned, so they can connect to another server with their current local player object.

James-Frowen commented 7 months ago

Its unclear how this will fully work.

Currently DestroyAllClientObjects() is called automatically by OnClientDisconnected to clean up objects, but I assume you new function would have to be called manually before disconnecting?

One problem I see with this is that the player object wont have its network state cleaned up, like its netid or callbacks. It might be better instead to use an UnspawnHandler for the player object that would allow Mirage to clean up without destroying the gameobject

GeekBrony commented 7 months ago

Thanks for the clarification. I'll try that instead.