Search Unity

  1. We have added dedicated sub-forums for UNet, the experimental MLAPI and Unity Transport Package. Please use the new forums to discuss related topics.
    Dismiss Notice
  2. How can our website serve you better? Give us your feedback. Take our survey and let us know.
    Dismiss Notice

How to get events using MLAPI?

Discussion in 'MLAPI' started by z0code0z, Mar 28, 2020.

  1. z0code0z

    z0code0z

    Joined:
    Apr 10, 2018
    Posts:
    30
    Hello, I'm trying to get events such as connection failed and the reason why (wrong connectiondata/password, no server found, etc.)

    And then allowing the client to be able to see these errors

    I've tried using sockettasks and either I'm not using them correctly or they don't provide the functionality I'm looking for

    If anyone could help, it'd be greatly appreciated!!

    @TwoTen

    EDIT: also if there is any documentation regarding this, if you could link it! I couldn't find any except some commits which I couldn't figure out
     
  2. z0code0z

    z0code0z

    Joined:
    Apr 10, 2018
    Posts:
    30
    I tried using sockettasks but I wasn't sure how to use them and/or I don't believe they give off when a client is disconnected due to wrong password
     
  3. TwoTen

    TwoTen

    Unity Technologies

    Joined:
    May 25, 2016
    Posts:
    1,167
    There are events in the NetworkingManager for you to use. However, there is no way to extract why the connection failed as most transports do not support this feature.
     
  4. z0code0z

    z0code0z

    Joined:
    Apr 10, 2018
    Posts:
    30
    Yup I just made a basic code that detects when the client SHOULD timeout (obv match the value with what you set in the transport) and then if the client is disconnected (theres a callback for this) check when they were disconnected, before the timeout or after

    if it was before the timeout, we can chalk it to the wrong password
    if it was after the timeout, then it was due to no connection or taking too long to respond
     
unityunity