Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

NAT Traversal - Automatic port forwarding, punch-through, and more!

Discussion in 'Assets and Asset Store' started by thegreatzebadiah, Apr 5, 2016.

  1. TwistedSage

    TwistedSage

    Joined:
    Dec 12, 2012
    Posts:
    21
    I made a simple NAT punchthrough with mono.nat and listen and it worked perfect. I think the facilitator is an unnecessary extra step. I'll check the raknet documentation ;)
     
  2. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    836
    mono nat is not punch-through it is only port forwarding unless it has some features I don't know about. They are two different things, punch-through is able to make a connection in cases where port forwarding fails or is not possible
     
  3. TwistedSage

    TwistedSage

    Joined:
    Dec 12, 2012
    Posts:
    21
    I see know. The facilitator simply grabs the IP and ports of the clients sending UDP packets to connect and then "facilitates it". But with mono.net you can just setup the port forwarding, no extra server required. So the facilitator is just to make sure it works in all cases, where port forwarding is not supported in the router?
     
  4. qingmeng

    qingmeng

    Joined:
    Oct 29, 2016
    Posts:
    5
    @thegreatzebadiah

    Ok thanks. I'll experiment a bit first.

    I had encountered a weird issue. I got things connected with punch through when I use my Macbook as a server. And it works pretty consistently. But with my company Macbook. Things are a bit strange. It will generally work when it's freshly run. But after a while it'll stop working. But it's also specific to the agent. For instance, if hosting in the editor mode stopped working, then hosting it in an compiled app may still work. And it'll work consistently for a bit until not working again... Then after a longer time, things will work again.. And finally, hosting in my Windows PC doesn't work.

    For more details, I have my own match server that passes the public/private network address and guid to the client. Then client do StartClientAll(remote, internal, guid).
     
  5. TCROC

    TCROC

    Joined:
    Aug 15, 2015
    Posts:
    230
    Ok so I found a couple bugs with NAT Traversal.
    1.) In the OnServerAddPlayer () method in the NetworkManager, if base.OnServerAddPlayer () is not included in the override, when migrating hosts, the new host will teleport and not be able to move correctly. This only occurs if the player that I am moving is being synced across the network by a NetworkTransfromChild component and base.OnServerAddPlayer() is not included in the override.

    2.) This bug occurs when adding the base.OnServerAddPlayer() in the override. When a player spawns, the NetworkManager autoGenerates the playerPrefab and instantiates the playerPrefab I have set up to spawn by OnServerAddPlayer ().

    3.) Upon disconnecting as the host, and a new host is picked, I cannot find and join the match by pressing the join button. I understand host migration only works with direct connections. I do not use the relay server.

    I have a project containing a much more in depth description of the bugs. Would you like me to upload it to this forum or would you rather me send it to you? I do not know how Unity works asset wise and if I upload the project whether or not I would be uploading your NAT Traversal asset for everybody to get for free. I would not want to do that. If you want me to send it to you, do you have an email address or something to send it to?
     
  6. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    836
  7. qingmeng

    qingmeng

    Joined:
    Oct 29, 2016
    Posts:
    5
    @thegreatzebadiah I had some more progress in the issue I mentioned earlier.
    When starting match without using unity matchmaker and joining using internal/remote/guid, punching works fine when hosting on Mac but not on Windows.
    When starting with unity matchmaker service, and joining using StartClientAll(match), punching to a Windows host works as well.
     
  8. TwistedSage

    TwistedSage

    Joined:
    Dec 12, 2012
    Posts:
    21
    Is it possible to use the system, without the unity relay server? Without setting up the unity network services at all.
     
  9. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    836
    @TwistedSage Yep. Without relays though you are not guaranteed to be able to connect 100% of the time. There are some router configurations where even punch-through will not work. You will also have to replace UNet's matchmaking with some other way of passing around the host's connection info. Steam lobbies are a popular choice but there are many options.

    @TCROC @qingmeng I'm kind of ignoring you guys at the moment but you are top of my list for the next wave of fixes. Sorry for the wait.
     
    Last edited: Dec 2, 2016
  10. WaaghMan

    WaaghMan

    Joined:
    Jan 27, 2014
    Posts:
    245
    Hello again,

    Our latest version of the project (updated to Unity 5.5) seems to have stopped working properly. Not sure of the specific issue yet (so not sure if it's related to the plugin or not).

    However, I've found that now the plugin says "NATTraveral: Attempting to connect directly: " and an IPv6 address, where it previously showed an IPv4, and it could be because of this.

    In the meanwhile I'll try removing the IPv6 support and see what happens.
     
  11. WaaghMan

    WaaghMan

    Joined:
    Jan 27, 2014
    Posts:
    245
    PS: Now I'm pretty sure this is the cause. From users' logs I can see sessions were attempting to join IPv6 addresses and having timeouts.
     
  12. WaaghMan

    WaaghMan

    Joined:
    Jan 27, 2014
    Posts:
    245
    Ok, I think people are managing to connect properly now.

    So, last issue, it's actually something @Jos-Yule mentioned a few months ago. When using UNET relays, sometimes it gives the following error when trying to join a supposedly valid match:

    Code (csharp):
    1. Could not join match: 0 - failed: Failed enumerating host node id appId=1917202. Match is likely unavailable, please select another to join.
    There's not much info around on this so I'm not really sure what can be happening (and UNET matchmaking source code is not available so I can't check that either), but it's the most common connection issue we're having now.
     
  13. iddqd

    iddqd

    Joined:
    Apr 14, 2012
    Posts:
    500
    How can i check on the server, if the client that just connected is relayed or not?

    I thought this would work, but it doesn't ;-)
    Code (CSharp):
    1.  
    2. public override void OnServerConnect(NetworkConnection conn)
    3.     {
    4.         if (conn == relayCon)
    5.             GetComponent<MyMigrationManager>().hostMigration = false;
    6.  
    7.         base.OnServerConnect(conn);
    8.     }
    9.  
    The reason i need this, is because i need to disable the host migration on the server for relayed matches otherwise the clients cannot connect at all, they get errors. So it's quite important since i need host migration, but i need to disable it or else relayed connection don't work at all.
     
  14. Jos-Yule

    Jos-Yule

    Joined:
    Sep 17, 2012
    Posts:
    292
    Getting the following Null Ref error, deep in the bowls of NatT code...

    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. NATTraversal.NetworkManager.createClient () (at E:/_Noble Whale/NAT Traversal Stuff/NAT Traversal DLL/NATTraversalForUNET/NetworkManager.cs:1553)
    3. NATTraversal.NetworkManager.StartClientAll (System.String hostExternalIP, System.String hostInternalIP, UInt64 hostGUID, NetworkID matchID, System.String hostExternalIPv6, System.String hostInternalIPv6, UnityEngine.Networking.Match.DataResponseDelegate`1 joinMatchCallback, System.String matchPassword, Int32 eloScore, Int32 requestDomain, Boolean matchAlreadyJoined) (at E:/_Noble Whale/NAT Traversal Stuff/NAT Traversal DLL/NATTraversalForUNET/NetworkManager.cs:444)
    4. ScarcityNetworkManager.JoinMatch (UInt64 lobbyId) (at Assets/Scarcity/Scripts/Networking/ScarcityNetworkManager.cs:236)
    5. GameInitializationAndCleanup+<JoinLobbyHelper>c__IteratorAF.MoveNext () (at Assets/Scarcity/Scripts/Game Setup/GameInitializationAndCleanup.cs:353)
    6. UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) (at /Users/builduser/buildslave/unity/build/Runtime/Export/Coroutines.cs:17)
    7.  
    Have not seen this before the update to 1.46. Can no longer make connections to Hosts. Haven't tried turning off some of the different Host connection options yet... Seeing if something else has changed on my end, some missing value i'm sending into StartClientAll()...

    Also, when stopping Unity Editor's playing of the project, we get this treading error, which is also new to 1.46 being installed.

    Code (CSharp):
    1. EntryPointNotFoundException: SwitchToThread
    2. System.Threading.Platform.Yield ()
    3. System.Threading.ManualResetEventSlim.Wait (Int32 millisecondsTimeout, CancellationToken cancellationToken)
    4. System.Threading.Tasks.Task.InternalWait (Int32 millisecondsTimeout, CancellationToken cancellationToken)
    5. System.Threading.Tasks.Task.Wait (Int32 millisecondsTimeout, CancellationToken cancellationToken)
    6. System.Threading.Tasks.Task.Wait ()
    7. NATTraversal.NATHelper.OnDestroy () (at E:/_Noble Whale/NAT Traversal Stuff/NAT Traversal DLL/NATTraversalForUNET/NATHelper.cs:616)
    8.  
     
  15. Jos-Yule

    Jos-Yule

    Joined:
    Sep 17, 2012
    Posts:
    292
    So removing all options other then Matchmaking and Relay connections i'm still getting the first error. I am sending the required vars, and have confirmed that they all have values going into the function:
    Code (CSharp):
    1. this.StartClientAll(publicIP, internalIP, hostGUID, matchID);
     
  16. akuno

    akuno

    Joined:
    Dec 14, 2015
    Posts:
    84
    @thegreatzebadiah What is the best way to deal with a player voluntary disconnect? I am calling StopClientAll() and NetworkServer.SetClientNotReady(conn) inside OnClientDisconnect() but I am still getting "host id out of bound id {0} max id should be greater 0 and less than {0}"
     
  17. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    836
    I believe this means that the match host is no longer actually hosting. Why the match is still in the list if there is no host is a bit of a mystery. I believe it can happen if the the host crashes and NetworkMatch.DropConnection doesn't get called. I'm not sure if there's anything that can be done about it other than what it says, "select another to join." You could also try sprinkling some extra calls to DropConnection around like in OnApplicationQuit() maybe
     
  18. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    836
    Good thinking but that only works on the clients unfortunately. I honestly don't know of any way to check this right now on the server. I think your best bet might be to have the clients send a message to the server letting them know what type of connection they are using.
     
  19. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    836
    Just emailed you about this.

    I haven't been seeing this one but I'll look for any suspicious code in the area.
     
  20. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    836
    If you're in OnClientDisconnect() then you're already disconnected right? Calling StopClient() on a gui button press or whenever should get the job done.
     
  21. Jos-Yule

    Jos-Yule

    Joined:
    Sep 17, 2012
    Posts:
    292
  22. navagames

    navagames

    Joined:
    Jun 5, 2015
    Posts:
    3
    I was super excited when i read about the features of this product, until i seen there is no mobile support. Is there an update on this initiative? Specifically Android? Thanks!
     
  23. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    836
    There is not sorry.
     
  24. iddqd

    iddqd

    Joined:
    Apr 14, 2012
    Posts:
    500
    Ok, so what i did is disable the host migration by default, and then check on the client if it's relayed. If not, i let the server know that he should enable migration.

    Of course it would be great if this was not needed and we could just leave host migration enabled.
     
    thegreatzebadiah likes this.
  25. TCROC

    TCROC

    Joined:
    Aug 15, 2015
    Posts:
    230
  26. Jos-Yule

    Jos-Yule

    Joined:
    Sep 17, 2012
    Posts:
    292
    I'm once again befuddled. I'm trying to disconnect a client from a server. I'm simply calling the StopClient() method on my class which extends NATTraversal.NetworkManager(). I always get the following error spammed into the console
    Code (CSharp):
    1. host id out of bound id {1} max id should be greater 0 and less than {0}
    2. UnityEngine.Networking.NetworkIdentity:UNetStaticUpdate()
    3.  
    I'm not sure what else i should have done on the client to prevent this? Is there anything other then StopClient() that needs to be called?

    [Addition] Ok, so this error happens the second time i connect to the server and then disconnect, not the first time. So there is something being held my the client side - could be my code, am continuing to debug.
     
    Last edited: Dec 12, 2016
  27. Jos-Yule

    Jos-Yule

    Joined:
    Sep 17, 2012
    Posts:
    292
    Finally managed to cause a real error which we might be able to track down
    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. NATTraversal.NetworkManager.replaceConnection (UnityEngine.Networking.NetworkConnection oldConn, UnityEngine.Networking.NetworkConnection newConn) (at E:/_Noble Whale/NAT Traversal Stuff/NAT Traversal DLL/NATTraversalForUNET/NetworkManager.cs:1485)
    3. NATTraversal.NetworkManager.OnMultiClientConnect (UnityEngine.Networking.NetworkConnection conn) (at E:/_Noble Whale/NAT Traversal Stuff/NAT Traversal DLL/NATTraversalForUNET/NetworkManager.cs:1333)
    4. NATTraversal.NetworkManager.OnMultiClientConnectInternal (UnityEngine.Networking.NetworkConnection conn) (at E:/_Noble Whale/NAT Traversal Stuff/NAT Traversal DLL/NATTraversalForUNET/NetworkManager.cs:1253)
    5. NATTraversal.NetworkManager.OnMultiClientConnectMsg (UnityEngine.Networking.NetworkMessage netMsg) (at E:/_Noble Whale/NAT Traversal Stuff/NAT Traversal DLL/NATTraversalForUNET/NetworkManager.cs:1199)
    6. UnityEngine.Networking.NetworkConnection.InvokeHandler (Int16 msgType, UnityEngine.Networking.NetworkReader reader, Int32 channelId) (at /Users/builduser/buildslave/unity/build/Extensions/Networking/Runtime/NetworkConnection.cs:217)
    7. UnityEngine.Networking.NetworkConnection.InvokeHandlerNoData (Int16 msgType) (at /Users/builduser/buildslave/unity/build/Extensions/Networking/Runtime/NetworkConnection.cs:199)
    8. UnityEngine.Networking.NetworkClient.Update () (at /Users/builduser/buildslave/unity/build/Extensions/Networking/Runtime/NetworkClient.cs:718)
    9. UnityEngine.Networking.NetworkClient.UpdateClients () (at /Users/builduser/buildslave/unity/build/Extensions/Networking/Runtime/NetworkClient.cs:950)
    10. UnityEngine.Networking.NetworkIdentity.UNetStaticUpdate () (at /Users/builduser/buildslave/unity/build/Extensions/Networking/Runtime/NetworkIdentity.cs:1073)
    This occurs when connecting to a server i have previously disconnected (successfully) from.
     
  28. Jos-Yule

    Jos-Yule

    Joined:
    Sep 17, 2012
    Posts:
    292
    It still seems that most of my issues come from not understanding how to properly shut down the networking system, on both client and server/host. Any combo of StopHost, StopServer and StopClient do not actually seem to properly shut everything down, and i continue to get strange host id out of bounds errors, or re-connection attempts after i've disconnected.
     
    akuno likes this.
  29. Jos-Yule

    Jos-Yule

    Joined:
    Sep 17, 2012
    Posts:
    292
    I further wonder if because i am manually calling the ClientScene.AddPlayer() method:
    Code (CSharp):
    1. ClientScene.AddPlayer(ClientScene.readyConnection, (short)validNumber, new StringMessage(isBot.ToString()));
    has anything to do with the issues i'm having? Because i'm manually passing the ClientScene.readyConnection, and sometimes this connection changes, as the NAT Traversal code changes the type of connection i've made...
     
  30. TCROC

    TCROC

    Joined:
    Aug 15, 2015
    Posts:
    230
    @thegreatzebadiah Hey I just got the host migration working with the transfromSyncChild components. It turns out the issue occurred when not having Unity instantiate the original player game object assigned in the NetworkManager. If I use anything else besides the original player game object during runtime, the issue with the sliding will occur. I found a work around for it. All I do is make sure my player is the player you originally assign in the NetworkManager. If you have to change game objects that have a transfromSychChild component during run time, you can't change the gameObject they are assigned too, but instead have to change the components of that game object. This code only works if the other object you are changing too does not have a transfromSychChild component:

    Code (CSharp):
    1. public override void OnServerAddPlayer(NetworkConnection conn, short playerControllerId)
    2.     {
    3.  
    4.         base.OnServerAddPlayer(conn, playerControllerId);
    5.  
    6.         if (gameStateManager.GetComponent<GameStateManager> ().gMode == GameMode.lobby) {
    7.             foreach (PlayerController pC in conn.playerControllers) {
    8.                 NetworkServer.Destroy (pC.gameObject);
    9.             }
    10.             GameObject player = Instantiate (lobbyPrefab);
    11.             NetworkServer.Spawn (player);
    12.  
    13.             // Might need to add player for connection as done below but it seems to work for me without it
    14.             //NetworkServer.AddPlayerForConnection (conn, player, playerControllerId);
    15.             NetworkServer.ReplacePlayerForConnection( conn, player, playerControllerId );
    16.         }
    17.     }
    FYI: The base.OnServerAddPlayer does have to be called as well or else the original player in the NetworkManager won't be instantiated and the sliding will occur.
     
  31. Jos-Yule

    Jos-Yule

    Joined:
    Sep 17, 2012
    Posts:
    292
    I also see sometimes that the "online" scene is being loaded twice. I see the scene name in the hierarchy twice, with "(not loaded)" appended. Only one instance will ever really load, but this does cause my game to not work, although i'm not sure what is happening to cause this, but it is connected to this double-loading issue, i think... :) At least till i find some other code which is the culprit!
     
    Last edited: Dec 13, 2016
  32. TCROC

    TCROC

    Joined:
    Aug 15, 2015
    Posts:
    230
    I had the same issue as well. What u need to do is have the load scene method inside an if statement with a Boolean. As soon as you call the load scene method, set the Boolean to true. As long as the Boolean is false, you can call the method. More than one of the same scene being loaded is a result of the load scene method being called multiple times.
     
  33. Jos-Yule

    Jos-Yule

    Joined:
    Sep 17, 2012
    Posts:
    292
    @TCROC I'm not manually calling a load scene method however - i'm using the built in capability of the Network Manager and its "online scene" property.
     
  34. TCROC

    TCROC

    Joined:
    Aug 15, 2015
    Posts:
    230
    Oh I see. That is very strange. My online scene is a lobby scene that has a very fast load time (idk if that makes a difference) and then from their I manually load the rest of my scenes. I guess a workaround until u find what the issue is could be to manually load all of your scenes.
     
  35. Jos-Yule

    Jos-Yule

    Joined:
    Sep 17, 2012
    Posts:
    292
    @TCROC Yeah, do you send the required scene via an RPC/CMD or how do you inform your clients which scene to load?
     
  36. TCROC

    TCROC

    Joined:
    Aug 15, 2015
    Posts:
    230
    No its much easier than that. All you have to do is call ServerChangeScene (string sceneName) within the NetworkManager. The method is a built in method to NetworkManager and changes the scene for all clients. It will look something like this.
    Code (CSharp):
    1. bool loadScene = false;
    2. string sceneName = "SceneName";
    3.  
    4. void Update () {
    5.       if (loadScene) {
    6.             ServerChangeScene (sceneName);
    7.             loadScene = false;
    8.       }
    9. }
     
  37. Jos-Yule

    Jos-Yule

    Joined:
    Sep 17, 2012
    Posts:
    292
    @TCROC Yeah ok - but I was getting the error on a client which had connected to a server - the server had been in the loaded scene for some time, it wasn't the one with the double-loading of the scene. I feel like it was some kind of mixup between the different clients connecting and disconnecting, when attempting a direct connection and punch-through and relay all at once, somehow they crossed wires and got the message to load the scene twice.
     
  38. TCROC

    TCROC

    Joined:
    Aug 15, 2015
    Posts:
    230
    That is strange. I cannot say I've had that issue.
     
  39. BmDeveloperz

    BmDeveloperz

    Joined:
    Jul 1, 2013
    Posts:
    62
    I have updated my unity version to 5.5.0p1 today and got this error on NAT plugin.

    Assets/NAT Traversal Example/ExampleNetworkManager.cs(22,38): error CS0122: `UnityEngine.Networking.Match.ListMatchResponse' is inaccessible due to its protection level

    Anyone knows a solution to it ?

    Thanks.
     
  40. BmDeveloperz

    BmDeveloperz

    Joined:
    Jul 1, 2013
    Posts:
    62
  41. BmDeveloperz

    BmDeveloperz

    Joined:
    Jul 1, 2013
    Posts:
    62
    I fixed the issue by changing #if UNITY_5_4 to #if UNITY_5_5 but i couldn't test if there is any other problem
     
    thegreatzebadiah likes this.
  42. WaaghMan

    WaaghMan

    Joined:
    Jan 27, 2014
    Posts:
    245
    New stacktrace reported from a single user:

    Code (csharp):
    1.  
    2. StartHostAll Exception: Object reference not set to an instance of an object - at System.String.memcpy1 (System.Byte* dest, System.Byte* src, Int32 size) [0x00000] in <filename unknown>:0
    3. at System.String.memcpy (System.Byte* dest, System.Byte* src, Int32 size) [0x00000] in <filename unknown>:0
    4. at (wrapper unknown) System.Net.NetworkInformation.Win32_IP_ADAPTER_UNICAST_ADDRESS:PtrToStructure (intptr,object)
    5. at (wrapper managed-to-native) System.Runtime.InteropServices.Marshal:PtrToStructure (intptr,System.Type)
    6. at System.Net.NetworkInformation.UnicastIPAddressInformationImplCollection.Win32FromUnicast (Int32 ifIndex, IntPtr ptr) [0x00000] in <filename unknown>:0
    7. at System.Net.NetworkInformation.Win32IPInterfaceProperties2.get_UnicastAddresses () [0x00000] in <filename unknown>:0
    8. at NATTraversal.NetworkManager.getLocalIPv6 () [0x00000] in <filename unknown>:0
    9. at NATTraversal.NetworkManager.StartHostAll (System.String matchName, UInt32 maxPlayers, Boolean advertise, System.String password, Int32 eloScore, Int32 requestDomain, UnityEngine.Networking.Match.DataResponseDelegate`1 callback) [0x00000] in <filename unknown>:0
    10. at QuickJoinScript+<SetupServer>c__Iterator6.MoveNext () [0x00000] in <filename unknown>:0
    11.  
    In short, it crashes when trying to obtain the local IPv6, and StartHostAll() doesn't continue because of that. Probably because the user had a faulty network setup, since the log shows problems in other areas as well, but anyway the exception should be properly dealt with inside the getLocalIPv6() method.

    Just as a reminder, we've ditched IPv6 support on our game and not setting IPv6 values anywhere (connections have been more stable after we did that).
     
  43. Ali_V_Quest

    Ali_V_Quest

    Joined:
    Aug 2, 2015
    Posts:
    138
    Any updates on mobile support ?
     
  44. coldzik

    coldzik

    Joined:
    Jan 2, 2013
    Posts:
    12
    What I must do in case of punched hole?
    I use steam for matchmaking and do steps like this:
    Host creating steam lobby with data like this:

    Code (CSharp):
    1. SteamMatchmaking.SetLobbyData(steamIDLobby, "guid", natHelper.guid.ToString());
    2.           SteamMatchmaking.SetLobbyData(steamIDLobby, "publicIP", externalIP);
    3.           SteamMatchmaking.SetLobbyData(steamIDLobby, "internalIP", internalIP);
    next I start hosting using StartHostAll()
    client join to lobby and get lobby data
    client trying to connect, but they can't
    host and client get information about punched hole on specific port
    and there is problem :)
    I must stop host and start new host on this specific port or this should be done automatically? On client i got msg log:
    NATTraveral: Attempting to connect through hole 193.224.56.112:54330
    but client still can't connect
     
    Last edited: Dec 17, 2016
  45. qingmeng

    qingmeng

    Joined:
    Oct 29, 2016
    Posts:
    5
    @TCROC @qingmeng I'm kind of ignoring you guys at the moment but you are top of my list for the next wave of fixes. Sorry for the wait.[/QUOTE]

    Thank you! I did get it working by using unity matchmaking. So not the biggest deal. Though I do hope to move away. I'll check back sometime in the future.
     
  46. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    836
    @slake_it No updates on the plan to add mobile support. It's the next feature we want to add but it might be awhile.

    Looking into some things and will get back to the rest of you tomorrow.
     
    KyleOlsen likes this.
  47. Doghelmer

    Doghelmer

    Joined:
    Aug 30, 2014
    Posts:
    120
    I'm getting this exact same error. Still on 1.4.1f1. No idea what the cause might be. Did you guys ever reach a resolution on this?
     
  48. WaaghMan

    WaaghMan

    Joined:
    Jan 27, 2014
    Posts:
    245
    @coldzik What you're doing is what we do and it works. Are you sure you're running the Facilitator (or using the grabblesgame one) and have properly configured the facilitator's address? It could also be a problem of your network setup not supporting NAT punchthrough.
     
  49. Jos-Yule

    Jos-Yule

    Joined:
    Sep 17, 2012
    Posts:
    292
    @Doghelmer I think i had used a reflection based Awake method in my child NetworkManager class. I just had to replace that with a call to base.Awake().
     
  50. Doghelmer

    Doghelmer

    Joined:
    Aug 30, 2014
    Posts:
    120
    Thanks, that fixed the issue!

    Now I'm getting this other NullReferenceException. Any ideas on this one?

    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. NATTraversal.NetworkManager.OnMatchJoined (Boolean success, System.String extendedInfo, UnityEngine.Networking.Match.MatchInfo info) (at E:/_Noble Whale/NAT Traversal Stuff/NAT Traversal DLL/NATTraversalForUNET/NetworkManager.cs:972)
    3. UnityEngine.Networking.Match.NetworkMatch.OnMatchJoined (UnityEngine.Networking.Match.JoinMatchResponse response, UnityEngine.Networking.Match.DataResponseDelegate`1 userCallback) (at C:/buildslave/unity/build/Runtime/Networking/Managed/MatchMakingClient.cs:220)
    4. UnityEngine.Networking.Match.NetworkMatch+<ProcessMatchResponse>c__Iterator0`2[UnityEngine.Networking.Match.JoinMatchResponse,UnityEngine.Networking.Match.NetworkMatch+DataResponseDelegate`1[UnityEngine.Networking.Match.MatchInfo]].MoveNext () (at C:/buildslave/unity/build/Runtime/Networking/Managed/MatchMakingClient.cs:426)
    5. UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) (at C:/buildslave/unity/build/Runtime/Export/Coroutines.cs:17)