Search Unity

  1. Are you interested in providing feedback directly to Unity teams? Sign up to become a member of Unity Pulse, our new product feedback and research community.
    Dismiss Notice

Best way to call disconnect client and disconnect host

Discussion in 'Multiplayer' started by xeonheart, Jun 26, 2021.

  1. xeonheart

    xeonheart

    Joined:
    Jul 24, 2018
    Posts:
    114
    Hello,

    sorry, hopefully i can explain this, But right now, I am using 2 methods honestly:

    networkManager.StartHost()
    networkManager.Startclient()

    so, I assume lets say I am a client that joined person that StartHost(), would you say StopClient() be the one to be called if a StartClient() wants to disconnect from a game?

    what if the person is StartHost(), would that be StopHost(), I did look at the documentation:

    https://mirror-networking.gitbook.io/docs/guides/networkbehaviour

    BUT my main question is this, is there a method or something to use that if I am actually the host, then use StopHost(), BUT if I am a Client or joined by using StartClient(), then use StopClient(), is there a method or something that can Identifiy that either I am the Server/Cleint aka host or just client? or should i just use a Bit, 0 = client and 1 = client/server aka host?
     
unityunity