UNET - Password protection approach.

Hello everyone.

What would you recommend as an approach for password protection in order to prevent server from unwanted players connecting. I don’t use matchmaking, just created custom HUD with fields server, port, and password. At this moment it works like this:

  1. Host started. Host player spawned. Password set on server.

  2. Player connected. Player spawned. Some manager (on server side) checks if connected player object has correct password. If it’s not - it makes player disconnected.

I know it’s not a good way to protect server.
It would be better to do it like this:

public override OnServerConnected(var SomeConnectionInfo)
{
    if (SomeConnectionInfo.password == this.ServerPassword)
        base.OnServerConnected(SomeConnectionInfo);
    else
        Disconnect();

}

Or maybe I need to learn and use LLAPI for this.

Any help would be priceless, thank you.

I’m trying to get enougth people to support my feedback to get this integrated into the HLAPI - please vote on it here! https://feedback.unity3d.com/suggestions/password-protection-support-for-unet

use MysQL