[ad_1]
I’m creating a two participant multiplayer recreation. Since its solely two gamers, I do not wish to preserve my connection open if a participant disconnects.
Now this works properly from the host facet, via utilization of StopHost()
. If the participant who hosts disconnects, it disconnects each the gamers from the sport.
But utilizing StopHost()
within the consumer(Player B) facet doesn’t take away the host participant(Player A). In different phrases, the consumer is out of the sport, however the host remains to be within the recreation.
So, what I need is that if one participant(host or the consumer whoever it’s) disconnects, I need each of them to be disconnected.
So, how can I do it? Please assist me with this. I’ve nearly misplaced hope with UNET. Thanks
EDIT:
My setup is like this, my LobbyManager includes of UI parts like “TitlePanel”, “EssentialPanel”, and many others. The Disconnect button is a part of the title panel and will get enabled on press of Esc key. The button is linked to a script hooked up to the “TitlePanel”. This script makes use of a MonoBehaviour
which I modified to NetworkBehaviour
with a purpose to use [Command]
. But it would not work as my “Title Panel” doesn’t have a NetworkIdentity
. Adding one creates much more issues
So, I believed if there was a strategy to ship mesages from consumer to server with out NetworkBehaviour, then possibly I may ship a flag there to the server.
So is it doable?
[ad_2]