From 04c589dec94581a1c9761a8ad0ac71b8541dda12 Mon Sep 17 00:00:00 2001 From: Pascal Serrarens Date: Mon, 21 Feb 2022 18:11:54 +0100 Subject: [PATCH] Determine sitelocation for changed avatar possessions --- .../Scripts/Networking/HumanoidNetworking.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Runtime/HumanoidFree/Scripts/Networking/HumanoidNetworking.cs b/Runtime/HumanoidFree/Scripts/Networking/HumanoidNetworking.cs index e05bf8b..ae01075 100644 --- a/Runtime/HumanoidFree/Scripts/Networking/HumanoidNetworking.cs +++ b/Runtime/HumanoidFree/Scripts/Networking/HumanoidNetworking.cs @@ -154,8 +154,15 @@ namespace Passer.Humanoid { else name = humanoid.gameObject.name; - if (humanoid.remoteAvatar == null) + // Bug: + // The siteLocation should not be calculated dynamically every time because we could have moved to a new site! + if (humanoid.remoteAvatar == null) { + Possessable avatarPossessable = humanoid.avatarRig.GetComponent(); + if (avatarPossessable != null) + possessionLocation = avatarPossessable.siteLocation; + avatarPrefabName = humanoid.avatarRig.name; // .Substring(0, humanoid.avatarRig.name.Length - 7); + } else { Possessable avatarPossessable = humanoid.remoteAvatar.GetComponent(); if (avatarPossessable != null)