From 6166df3e8017977d00e30dacba8db4a35464f8bf Mon Sep 17 00:00:00 2001 From: Pascal Serrarens Date: Thu, 24 Feb 2022 15:57:33 +0100 Subject: [PATCH] Check if humanoid has an avatar when adding default avatar possession --- Runtime/Visitors/Scripts/VisitorPossessions.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Runtime/Visitors/Scripts/VisitorPossessions.cs b/Runtime/Visitors/Scripts/VisitorPossessions.cs index 563f536..c9d3af6 100644 --- a/Runtime/Visitors/Scripts/VisitorPossessions.cs +++ b/Runtime/Visitors/Scripts/VisitorPossessions.cs @@ -132,14 +132,17 @@ namespace Passer { Debug.Log("Cleared Possessions"); possessions = new List(); // new Possessions(); } + + if (humanoid.avatarRig != null) { + Possessable possessableAvatar = humanoid.avatarRig.GetComponent(); + if (possessableAvatar != null) + AddPossessions(new Possessable[] { possessableAvatar }, true); + } } // Default Possessions cannot be deleted AddPossessions(defaultPossessions, false); - Possessable possessableAvatar = humanoid.avatarRig.GetComponent(); - if (possessableAvatar != null) - AddPossessions(new Possessable[] { possessableAvatar }, true); } #endregion