Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

How to get network error id or message.

Discussion in 'Multiplayer' started by ysalpha, Feb 15, 2017.

  1. ysalpha

    ysalpha

    Joined:
    Feb 2, 2017
    Posts:
    52
    I'm using Unity MultiPlayer and MatchMaker.
    How do I get error message or id in Unity MultiPlayer?

    For example,
    Someone makes the room with password, and next another player tries to join that private room with invalid password.
    Of course it could't join the room.
    Then I can get the error string as below via OnMatchJoined(Boolean success,String extendedInfo,MatchInfo matchInfo) of extendedInfo.

    failed unity_JoinMatch for appId=2530653, serverId=InvalidFormatException:[System.FormatException: FAILURE Returned from server: failed unity_JoinMatch for appId=2530653, serverId=Invalid
    at UnityEngine.Networking.Match.Response.Parse (System.Object obj) [0x00051] in C:\buildslave\unity\build\Runtime\Networking\Managed\UNETInterface.cs:222
    at UnityEngine.Networking.Match.JoinMatchResponse.Parse (System.Object obj) [0x00003] in C:\buildslave\unity\build\Runtime\Networking\Managed\UNETInterface.cs:426
    at UnityEngine.Networking.Match.NetworkMatch+<ProcessMatchResponse>c__Iterator0`2[UnityEngine.Networking.Match.JoinMatchResponse,UnityEngine.Networking.Match.NetworkMatch+DataResponseDelegate`1[UnityEngine.Networking.Match.MatchInfo]].MoveNext () [0x00097] in C:\buildslave\unity\build\Runtime\Networking\Managed\MatchMakingClient.cs:410 ]
    UnityEngine.Debug:Log(Object)​

    However, This is too difficult to understand for users.


    I think that display following message is better than above long long difficult message.
    "Failed join room, it does not match password."

    But, Currently I can only get result (success or failed) via OnMatchXXX callback.
    It is not been determined connection failed reason then, So I can't display Easy-to-understand message.
    (Possibly it occurs another network connection error. e.g serverdown )

    Then, If Possible I get network error id. or Easy-to-understand error message.
    Is there a any ideas?

    Thanks
     
  2. LavaPatrik

    LavaPatrik

    Joined:
    Feb 21, 2017
    Posts:
    12
    I'm struggling with this exact issue myself, and Its sad this post haven't gotten any attention.

    The NetworkTransport has very clear and useful error responses in the form of the NetworkError-enum. ThisI can easily translate into something my users can understand (possibly even in their own language as opposed to English)

    But the Matchmaker only seem to have the extendedinfo-string, which gives me impossible to parse error messages like:

    Code (JavaScript):
    1. failed: Failed enumerating host node id appId=3074802. Match is likely unavailable, please select another to join.FormatException:[System.FormatException: FAILURE Returned from server: failed: Failed enumerating host node id appId=3074802. Match is likely unavailable, please select another to join.
    2.   at UnityEngine.Networking.Match.Response.Parse (System.Object obj) [0x00051] in /Users/builduser/buildslave/unity/build/Runtime/Networking/Managed/UNETInterface.cs:230
    3.   at UnityEngine.Networking.Match.JoinMatchResponse.Parse (System.Object obj) [0x00003] in /Users/builduser/buildslave/unity/build/Runtime/Networking/Managed/UNETInterface.cs:434
    4.   at UnityEngine.Networking.Match.NetworkMatch+<ProcessMatchResponse>c__Iterator0`2[UnityEngine.Networking.Match.JoinMatchResponse,UnityEngine.Networking.Match.NetworkMatch+DataResponseDelegate`1[UnityEngine.Networking.Match.MatchInfo]].MoveNext () [0x00097] in /Users/builduser/buildslave/unity/build/Runtime/Networking/Managed/MatchMakingClient.cs:422 ]
    Shipping a game with errors like this would be very unprofessional, and having to settle for vague messages like "An error occurred" just does not cut it.

    This really needs to be fixed!