I recently upgrade my Unity Editor to 5.2.1f1 Personal and have since been going about reworking my code so it would use UNET instead of Network View. After commenting out the old network connection code I was able to successfully connect a host and client using the Network Manager and Network Manager HUD components. Objects that have a Network Identity component will be disabled on start to be enabled once the session has been established as a Server or Client and it is on one of these objects, and on an object that has no networked components that I added the following code. This was run both when the instance was a Host by the Network Manager HUD, and when it was a client.
Code:
Debug.Log(Network.isServer);
Debug.Log(Network.isClient);
Return:
false
false
However, on the object that contained the Network Identity I was able to get the correct results.
Debug.Log(GetComponent<NetworkIdentity>().isServer);
Debug.Log(GetComponent<NetworkIdentity>().isClient);
This is all well and good, but some of the scripts I am using need to know if the instance that is running is a client or a server and do not have a Network Identity component attached to their object. Is there any global variable that a script can access that will return this correctly? And is this a Unity bug or by design (for which I would be grateful for an explanation)?