From 47370fe45171edc37fcb7a213cdfad3ffe32446a Mon Sep 17 00:00:00 2001 From: Fernando Cortez Date: Thu, 10 Nov 2022 14:51:34 -0500 Subject: [PATCH 1/3] removing unnecessary workaround to sync players' life states --- .../Character/ServerAnimationHandler.cs | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/Assets/Scripts/Gameplay/GameplayObjects/Character/ServerAnimationHandler.cs b/Assets/Scripts/Gameplay/GameplayObjects/Character/ServerAnimationHandler.cs index 59e151550..51c25ff80 100644 --- a/Assets/Scripts/Gameplay/GameplayObjects/Character/ServerAnimationHandler.cs +++ b/Assets/Scripts/Gameplay/GameplayObjects/Character/ServerAnimationHandler.cs @@ -1,5 +1,4 @@ using System; -using System.Collections; using Unity.BossRoom.Gameplay.Configuration; using Unity.Netcode; using Unity.Netcode.Components; @@ -24,18 +23,7 @@ public override void OnNetworkSpawn() { if (IsServer) { - // Wait until next frame before registering on OnValueChanged to make sure NetworkAnimator has spawned before. - StartCoroutine(WaitToRegisterOnLifeStateChanged()); - } - } - - IEnumerator WaitToRegisterOnLifeStateChanged() - { - yield return new WaitForEndOfFrame(); - m_NetworkLifeState.LifeState.OnValueChanged += OnLifeStateChanged; - if (m_NetworkLifeState.LifeState.Value != LifeState.Alive) - { - OnLifeStateChanged(LifeState.Alive, m_NetworkLifeState.LifeState.Value); + m_NetworkLifeState.LifeState.OnValueChanged += OnLifeStateChanged; } } From 3f7c235ffb4c321c7288f10bf7825fade769cf10 Mon Sep 17 00:00:00 2001 From: Fernando Cortez Date: Mon, 21 Nov 2022 16:58:36 -0500 Subject: [PATCH 2/3] changelog addition, null check --- .../GameplayObjects/Character/ServerAnimationHandler.cs | 2 +- CHANGELOG.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/Gameplay/GameplayObjects/Character/ServerAnimationHandler.cs b/Assets/Scripts/Gameplay/GameplayObjects/Character/ServerAnimationHandler.cs index 51c25ff80..84bc0b701 100644 --- a/Assets/Scripts/Gameplay/GameplayObjects/Character/ServerAnimationHandler.cs +++ b/Assets/Scripts/Gameplay/GameplayObjects/Character/ServerAnimationHandler.cs @@ -47,7 +47,7 @@ void OnLifeStateChanged(LifeState previousValue, LifeState newValue) public override void OnNetworkDespawn() { - if (IsServer) + if (IsServer && m_NetworkLifeState) { m_NetworkLifeState.LifeState.OnValueChanged -= OnLifeStateChanged; } diff --git a/CHANGELOG.md b/CHANGELOG.md index 898345513..4cf9222bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ Additional documentation and release notes are available at [Multiplayer Documen * Hosts now delete their lobby when shutting down instead of only leaving it (#772) Since Boss Room doesn't support host migration, there is no need to keep the lobby alive after the host shuts down. This also changes how LobbyServiceExceptions are handled to prevent popup messages on clients trying to leave a lobby that is already deleted, following the best practices outlined in this doc : https://docs.unity.com/lobby/delete-a-lobby.html * ### Cleanup -* +* Removed an unneeded workaround for animation syncing on OnNetworkSpawn of ServerAnimationHandler (#783) Refactorings to NetworkAnimator have made it unnecessary to manually sync an Animator's base animation state. ### Fixed * From aac0a7fd8b60b1ff4a6900529e0e733239792b56 Mon Sep 17 00:00:00 2001 From: Fernando Cortez Date: Mon, 26 Jun 2023 14:40:11 -0400 Subject: [PATCH 3/3] changelog cleanup, no need to force update on animator --- .../GameplayObjects/Character/ClientAvatarGuidHandler.cs | 1 - CHANGELOG.md | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Assets/Scripts/Gameplay/GameplayObjects/Character/ClientAvatarGuidHandler.cs b/Assets/Scripts/Gameplay/GameplayObjects/Character/ClientAvatarGuidHandler.cs index a3d76552f..05c243c8e 100644 --- a/Assets/Scripts/Gameplay/GameplayObjects/Character/ClientAvatarGuidHandler.cs +++ b/Assets/Scripts/Gameplay/GameplayObjects/Character/ClientAvatarGuidHandler.cs @@ -42,7 +42,6 @@ void InstantiateAvatar() Instantiate(m_NetworkAvatarGuidState.RegisteredAvatar.Graphics, m_GraphicsAnimator.transform); m_GraphicsAnimator.Rebind(); - m_GraphicsAnimator.Update(0f); AvatarGraphicsSpawned?.Invoke(m_GraphicsAnimator.gameObject); } diff --git a/CHANGELOG.md b/CHANGELOG.md index fac762d73..4c1997c2c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) Additional documentation and release notes are available at [Multiplayer Documentation](https://docs-multiplayer.unity3d.com). +## [unreleased] - yyyy-mm-dd +### Cleanup +* Removed an unneeded workaround for animation syncing on OnNetworkSpawn of ServerAnimationHandler (#783) Refactorings to NetworkAnimator have made it unnecessary to manually sync an Animator's base animation state. + ## [2.2.0] - 2023-06-14 ### Added