Unity-Multiplayer-Tutorials icon indicating copy to clipboard operation
Unity-Multiplayer-Tutorials copied to clipboard

ConnectionApprovalDelegate doesn't exist in Network Manager.

Open ritikwalgaonkar opened this issue 3 years ago • 2 comments

Assets\Tutorials\ObjectSpawning\Scripts\PasswordNetworkManager.cs(91,90): error CS0426: The type name 'ConnectionApprovedDelegate' does not exist in the type 'NetworkManager'

https://github.com/DapperDino/Unity-Multiplayer-Tutorials/blob/main/Assets/Tutorials/ObjectSpawning/Scripts/PasswordNetworkManager.cs line no.91

Only works in package (netcode for objects 1.0.0-pre.3) , doesn't work in updated packages of netcode. @DapperDino

ritikwalgaonkar avatar Dec 08 '22 05:12 ritikwalgaonkar

@ritikwalgaonkar that callback has been renamed to ConnectionApprovalCallback and has changed somewhat. Just update it with the docs shown here. https://docs-multiplayer.unity3d.com/netcode/current/basics/connection-approval

FrothyPants avatar Dec 10 '22 16:12 FrothyPants

@FrothyPants hey, sorry to bother - I am quite new to C# - but how would you implement the usage of the method ApprovalCheck in lines 44 and 60 of the ServerGameNetPortal.cs ? I changed the method itself so it would assign the needed values to the response but I do not understand the usage of += and -= on the ConnectionApprovalCallback event(?). Like how can we call ApprovalCheck without passing arguments?

My VS tells me: "No Overload for 'ApprovalCheck' matches delegate 'Action<NetworkManager.ConnectionApprovalRequest, NetworkManager.ConnectionApprovalResponse>"

image

Best Regards

fenix1stroke avatar Dec 12 '22 23:12 fenix1stroke