Search Unity

Network Problems

Discussion in 'Scripting' started by SecretItemGames, Apr 13, 2012.

  1. SecretItemGames

    SecretItemGames

    Joined:
    Apr 13, 2012
    Posts:
    32
    Im starting with Network Scripting and got the Problem that I get the "error CS0117: `Network' does not contain a definition for `peerType' " but the tutorial I watched did the exact same thing and it worked.

    This is where I get the error:

    Code (csharp):
    1. if (Network.peerType == NetworkPeerType.Disconnected)
    2. {
    3. }
    Where there any changes with the Unity patches so that this doesn´t work anymore?
    My Unity Version is 3.5.1 and I am using C#.
     
  2. foxter888

    foxter888

    Joined:
    May 3, 2010
    Posts:
    530
    so far of what i see from what you wrote the error seems right, you don't have a network peertype defined like for example
    Network.peerType = NetworkPeerType.Connected; and so on.

    don't you understand the error? it's giving you the answer.
     
  3. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,963
    Thats not needed. Network.peerType is automatically set when you Connect or start a server.
    And should default to NetworkPeerType.Disconnected.
    What the error says is that the Network class don't have a definition for peerType, not that its not set.
     
  4. SecretItemGames

    SecretItemGames

    Joined:
    Apr 13, 2012
    Posts:
    32
    So, what do I do now to check if I got connected or disconnected?

    Did Network.peerType got replaced by something else or why can´t I find it?
     
  5. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,963
    Well, no idea why it wont work, but i think you can use if(!Network.isClient) to see if you are connected or not. Depending on how you do with your server, you might have to use if(!Network.isClient !Network.isServer) to be sure.
     
  6. SecretItemGames

    SecretItemGames

    Joined:
    Apr 13, 2012
    Posts:
    32
    Also no definition for Network.isClient and Network.isServer.

    Do I have to include a specific header, or an Assat Package?
     
  7. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,963
    Ehh? That sounds very strange. I use Unitys networking myself and i have no problem with either isClient, isServer or peerType. Im using v3.5
     
  8. SecretItemGames

    SecretItemGames

    Joined:
    Apr 13, 2012
    Posts:
    32
    Fixed it, just reinstalled it I guess something on the installation did go wrong.
    Still thanks for the help if I wouldn´t have tried isClient/isServer i wouldn´t have gotten the idea that i have to reinstall it.