From 7c87da9bc7586b42abc3b2224e8f42e95f929f38 Mon Sep 17 00:00:00 2001 From: mischa Date: Tue, 2 Jan 2024 13:27:43 +0100 Subject: [PATCH] NetworkAnimator: OnSerialize syntax --- Assets/Mirror/Components/NetworkAnimator.cs | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/Assets/Mirror/Components/NetworkAnimator.cs b/Assets/Mirror/Components/NetworkAnimator.cs index 87b1efcf9..295afccff 100644 --- a/Assets/Mirror/Components/NetworkAnimator.cs +++ b/Assets/Mirror/Components/NetworkAnimator.cs @@ -375,18 +375,11 @@ public override void OnSerialize(NetworkWriter writer, bool initialState) { for (int i = 0; i < animator.layerCount; i++) { - if (animator.IsInTransition(i)) - { - AnimatorStateInfo st = animator.GetNextAnimatorStateInfo(i); - writer.WriteInt(st.fullPathHash); - writer.WriteFloat(st.normalizedTime); - } - else - { - AnimatorStateInfo st = animator.GetCurrentAnimatorStateInfo(i); - writer.WriteInt(st.fullPathHash); - writer.WriteFloat(st.normalizedTime); - } + AnimatorStateInfo st = animator.IsInTransition(i) + ? animator.GetNextAnimatorStateInfo(i) + : animator.GetCurrentAnimatorStateInfo(i); + writer.WriteInt(st.fullPathHash); + writer.WriteFloat(st.normalizedTime); writer.WriteFloat(animator.GetLayerWeight(i)); } WriteParameters(writer, initialState);