How to check if a host exists before starting a client or host
<p>I am trying to make my multiplayer game connect to the server as soon as the Scene is loaded, but I do not know how to check if a host already exists before hand, so that I know whether to call the function StartHost() or StartClient(). </p>

<p>I tried:</p>

<ol>
<li>Creating a Boolean SyncVar called hostExists that is set to true when StartHost() gets called on one of the players, so that if hostExists is equal to true, StartClient() will be called, but that doesn't work. </li>
<li>Using the OnFailedToConnect() function, so that if the connection fails, because there is already a host, the function will then call StartClient(), but that doesn't work either because the function only gets called if the StartClient() function fails.</li>
</ol>

<p>I am still a novice at networking, and I've been researching the web for a while to find this answer. Are there any Unity classes that will allow me to do a simple ping check? Thank you in advance for answering my question.</p>