Search Unity

UNet Network Manager Hud Matchmaker AppId fix.

Discussion in 'UNet' started by wartron, Jun 24, 2015.

  1. wartron

    wartron

    Joined:
    Jan 23, 2015
    Posts:
    8
    So I figured I'd post this here. For the longest time I was having issues new UNet NetworkMatch sending an Invalid or null appid to the UNet Server. From what I've gathered this is NOT the cloud project id, but below that in a small small text is the "UNET ID". You need to set this on the NetworkMatch Class.

    I have a slightly modified NetworkManager, and this is the code I used to set the proper AppId.

    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4. using UnityEngine.Networking;
    5. using UnityEngine.Networking.Match;
    6.  
    7. public class NetworkMan : NetworkManager
    8. {
    9.     private NetworkMatch networkMatch;
    10.    
    11.     void Update()
    12.     {
    13.         if(networkMatch == null)
    14.         {
    15.             var nm = GetComponent<NetworkMatch>();
    16.             if (nm != null) {
    17.                 networkMatch = nm as NetworkMatch;
    18.                 UnityEngine.Networking.Types.AppID appid = (UnityEngine.Networking.Types.AppID)94451;
    19.                 networkMatch.SetProgramAppID(appid);
    20.             }
    21.         }
    22.     }
    23. }
    24.  
    The NetworkMatch class is added by the NetworkManagerHud after you click the matchmaking option. I tried pre-adding a NetworkMatch class, but the hud added one anyway, so thats why I use the update and wait for the hud to add it, to set the appId.
     
    Athalansy and Xazerek like this.
  2. Xazerek

    Xazerek

    Joined:
    Nov 3, 2014
    Posts:
    134
    LOVE YOU! ITS WORKING !!