Add OnClientConnected and OnClientDisconnected methods to NetworkBehaviour #251
Closed
AlphaLul
started this conversation in
Feature Request
Replies: 1 comment 2 replies
-
Already exists as OnSpawnServer
…On Tue, Feb 7, 2023, 4:21 AM AlphaLul ***@***.***> wrote:
Currently, to do something on the server whenever a client connects or
disconnects, you have to subscribe a method to the
ServerManager.OnRemoteConnectionState event and then check if it is a
connection or a disconnection.
It would be useful to have a simple OnClientConnected and
OnClientDisconnected method in the NetworkBehaviour class that runs on the
server whenever a client connects or disconnects respectively. It could
have a NetworkConnection as a parameter to give info about the newly
connected or disconnected client. It should essentially function the same
as the current ServerManager.OnRemoteConnectionState event, but be
separated into connected/disconnected and built into the NetworkBehaviour
class for simplicity.
This would be super useful in use cases such as running a TargetRPC
whenever a client joins to provide the usernames of players that have
already joined, or removing a client from a team when the client leaves,
stuff like that.
—
Reply to this email directly, view it on GitHub
<#251>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AGPJC3WYHJC64GBCGJPKBEDWWIHYLANCNFSM6AAAAAAUTWQLHE>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Currently, to do something on the server whenever a client connects or disconnects, you have to subscribe a method to the ServerManager.OnRemoteConnectionState event and then check if it is a connection or a disconnection.
It would be useful to have a simple OnClientConnected and OnClientDisconnected method in the NetworkBehaviour class that runs on the server whenever a client connects or disconnects respectively. It could have a NetworkConnection as a parameter to give info about the newly connected or disconnected client. It should essentially function the same as the current ServerManager.OnRemoteConnectionState event, but be separated into connected/disconnected and built into the NetworkBehaviour class for simplicity.
This would be super useful in use cases such as running a TargetRPC whenever a client joins to provide the usernames of players that have already joined, or removing a client from a team when the client leaves, stuff like that.
Beta Was this translation helpful? Give feedback.
All reactions