Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note release note?

using System.Collections;
using Unity.BossRoom.Gameplay.Configuration;
using Unity.Netcode;
using Unity.Netcode.Components;
Expand All @@ -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;
}
}

Expand All @@ -59,7 +47,7 @@ void OnLifeStateChanged(LifeState previousValue, LifeState newValue)

public override void OnNetworkDespawn()
{
if (IsServer)
if (IsServer && m_NetworkLifeState)
{
m_NetworkLifeState.LifeState.OnValueChanged -= OnLifeStateChanged;
}
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down