From 2648083f15c37114c2c96729c52e29e5073f7052 Mon Sep 17 00:00:00 2001 From: Nestorboy <35258953+Nestorboy@users.noreply.github.com> Date: Sat, 27 Aug 2022 18:23:56 +0200 Subject: [PATCH] Fixed data writing when using multiple avatars. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Fixed an out of range exception when _GetAvatarBytes() was preparing an output array for any data avatar past the first one. • Fixed issue with data writing to more avatars by resetting the player velocity between avatar switches. --- Assets/Nessie/Udon/NUSaveState/Scripts/U#/NUSaveState.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Assets/Nessie/Udon/NUSaveState/Scripts/U#/NUSaveState.cs b/Assets/Nessie/Udon/NUSaveState/Scripts/U#/NUSaveState.cs index d1e6a06..6fc89cb 100644 --- a/Assets/Nessie/Udon/NUSaveState/Scripts/U#/NUSaveState.cs +++ b/Assets/Nessie/Udon/NUSaveState/Scripts/U#/NUSaveState.cs @@ -344,6 +344,7 @@ public void _SetData() // Write data by doing float additions. } else { + localPlayer.SetVelocity(Vector3.zero); SendCustomEventDelayedFrames(nameof(_VerifyData), 10); } } @@ -530,9 +531,9 @@ public byte[] _GetAvatarBytes() for (int boneIndex = 0; byteIndex < avatarByteCount; boneIndex++) { ushort bytes = _ReadParameter(boneIndex); - output[byteIndex++ + avatarByteOffset] = (byte)(bytes & 0xFF); + output[byteIndex++] = (byte)(bytes & 0xFF); if (byteIndex < avatarByteCount) - output[byteIndex++ + avatarByteOffset] = (byte)(bytes >> (ushort)8); + output[byteIndex++] = (byte)(bytes >> (ushort)8); } return output;