Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

Network does not exist in namespace UnityEngine - Cannot build for Windows Universal 8.1 using UNET

Discussion in 'UNet' started by Dudledok, Aug 27, 2015.

  1. Dudledok

    Dudledok

    Joined:
    Oct 24, 2013
    Posts:
    110
    I have been just fine testing and building this game for Windows and Mac but when I try and build for Windows Store Universal 8.1 I have a couple of errors, all the same:
    In each case I am doing the same thing which is getting the local ip address using the following code:
    Code (CSharp):
    1. Network.player.ipAddress
    If I change the code to specify that it's the Unity Engine Network class as follows:
    Code (CSharp):
    1. UnityEngine.Network.player.ipAddress
    Then I get the following error:
     
  2. Firoball

    Firoball

    Joined:
    Aug 6, 2015
    Posts:
    62
    It is UnityEngine.Networking

    The "Network" class is from the old networking system and deprecated. It does not work in conjunction with Unet.
     
  3. Dudledok

    Dudledok

    Joined:
    Oct 24, 2013
    Posts:
    110
    That makes sense. How would I access a player's local or public ip in Unet?
     
  4. Firoball

    Firoball

    Joined:
    Aug 6, 2015
    Posts:
    62
    NetworkServer.connections will give you a list of all NetworkConnections to clients.
    There you'll find the "address" member.
    For each client it's NetworkClient.connection
     
  5. Dudledok

    Dudledok

    Joined:
    Oct 24, 2013
    Posts:
    110
    You shouldn't need to be connected to anyone to know your own ip.
    Also, this won't necessarily return the same thing because if the client is the server too (i.e. the host) then it will say their connection is localhost or localserver etc, it won't return the ip.