From 0c77461df101d3aaaccfbec69ba633881e3cd0ec Mon Sep 17 00:00:00 2001 From: Falkonio Date: Thu, 28 Oct 2021 23:42:16 +0300 Subject: [PATCH] Update TeamPlayer.cs Apply already connected teams for late joined clients --- Assets/Tutorials/NetworkVariables/Scripts/TeamPlayer.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Assets/Tutorials/NetworkVariables/Scripts/TeamPlayer.cs b/Assets/Tutorials/NetworkVariables/Scripts/TeamPlayer.cs index 59baa80..ddd31bb 100644 --- a/Assets/Tutorials/NetworkVariables/Scripts/TeamPlayer.cs +++ b/Assets/Tutorials/NetworkVariables/Scripts/TeamPlayer.cs @@ -21,7 +21,13 @@ public void SetTeamServerRpc(byte newTeamIndex) // Update the teamIndex NetworkVariable teamIndex.Value = newTeamIndex; } - + + private void Start() + { + // Apply already connected teams for late joined clients + OnTeamChanged(0,teamIndex.Value); + } + private void OnEnable() { // Start listening for the team index being updated