Search Unity

No property reason of ConnectionApprovalResponse

Discussion in 'Netcode for GameObjects' started by rogelioae, May 2, 2023.

  1. rogelioae

    rogelioae

    Joined:
    May 20, 2022
    Posts:
    19
    Hi, I'm learning to deny connections with NetworkManager and I observed that the property "Reason" of ConnectionApprovalResponse does not appear in my editor and it class. I don't know if this is a bug. In the meantime, how can I write a connection decline reason?
     
  2. cerestorm

    cerestorm

    Joined:
    Apr 16, 2020
    Posts:
    664
    What version of Netcode are you running, I think
    Reason
    was added in 1.2.0.

    On the server/host set
    response.Reason
    to a string of your choice.

    On the client subscribe to the
    OnClientDisconnectCallback
    and in the callback read
    NetworkManager.Singleton.DisconnectReason
     
  3. rogelioae

    rogelioae

    Joined:
    May 20, 2022
    Posts:
    19
    My version is 1.1.0 but I can't update to version 1.2

    I updated the editor to version 2021.3.18f and it already has Netcode 1.2, with that the option appears. Could someone clarify for me if the editor version 2021.3.15f can update the Netcode to version 1.2.
     
    Last edited: May 3, 2023
  4. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,532
    You can update all the way to 1.4.0 manually by editing your package manifest. It doesn't show as an available update in package manager because it's not verified for that version yet - but unverified doesn't necessarily mean it incompatible.