diff --git a/Runtime/HumanoidFree/Scripts/Networking/HumanoidNetworking.cs b/Runtime/HumanoidFree/Scripts/Networking/HumanoidNetworking.cs index 5c988a7..4ab63ab 100644 --- a/Runtime/HumanoidFree/Scripts/Networking/HumanoidNetworking.cs +++ b/Runtime/HumanoidFree/Scripts/Networking/HumanoidNetworking.cs @@ -1498,7 +1498,10 @@ namespace Passer.Humanoid { if (msg.possessionLocation != null) { Debug.Log("Need to download avatar possession from " + msg.possessionLocation); - VisitorPossessions.RetrievePossessableAsync(msg.possessionLocation, msg.avatarPrefabName, retrievedAvatar => ProcessRetrievedAvatar(networking, remoteHumanoid, retrievedAvatar)); + HumanoidPlayer.instance.StartCoroutine( + VisitorPossessions.RetrievePossessableAsync(msg.possessionLocation, msg.avatarPrefabName, + retrievedAvatar => ProcessRetrievedAvatar(networking, remoteHumanoid, retrievedAvatar)) + ); return; } diff --git a/Runtime/HumanoidFree/Scripts/Networking/HumanoidPlayer.cs b/Runtime/HumanoidFree/Scripts/Networking/HumanoidPlayer.cs index a773613..feb0956 100644 --- a/Runtime/HumanoidFree/Scripts/Networking/HumanoidPlayer.cs +++ b/Runtime/HumanoidFree/Scripts/Networking/HumanoidPlayer.cs @@ -1,4 +1,5 @@ using System; +using System.Collections; using System.Collections.Generic; using UnityEngine; @@ -125,6 +126,8 @@ namespace Passer.Humanoid { public List humanoids { get; set; } protected virtual void Awake() { + mInstance = this; + GameObject.DontDestroyOnLoad(this.gameObject); humanoids = HumanoidNetworking.FindLocalHumanoids(); @@ -139,6 +142,20 @@ namespace Passer.Humanoid { } } + static HumanoidPlayer mInstance; + public static HumanoidPlayer instance { + get { + if (mInstance == null) { + Debug.LogWarning("No HumanoidPlayer instance found, instantiating a new instance..."); + GameObject go = new GameObject(); + mInstance = go.AddComponent(); + } + return mInstance; + } + } + //public static void StartStaticCoroutine(IEnumerator coroutineMethod) { + // StartCoroutine(coroutineMethod); + //} #endif [SerializeField] diff --git a/Runtime/Visitors/Scripts/VisitorPossessions.cs b/Runtime/Visitors/Scripts/VisitorPossessions.cs index 6cb6f78..0abee0e 100644 --- a/Runtime/Visitors/Scripts/VisitorPossessions.cs +++ b/Runtime/Visitors/Scripts/VisitorPossessions.cs @@ -279,6 +279,7 @@ namespace Passer { GameObject prefab; if (possessableLocation == "") { + Debug.Log("Cannot retrieve Possessable: location is not set"); yield return null; } else { diff --git a/Samples~/VisitorsAndSites/Visitors/HumanoidVisitor Desktop.unity b/Samples~/VisitorsAndSites/Visitors/HumanoidVisitor Desktop.unity index 20854b6..7d51674 100644 --- a/Samples~/VisitorsAndSites/Visitors/HumanoidVisitor Desktop.unity +++ b/Samples~/VisitorsAndSites/Visitors/HumanoidVisitor Desktop.unity @@ -2345,7 +2345,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: loadSiteAtStart: 0 - startSite: passervr.com/sites/avatarshop + startSite: passervr.com/sites/start startScene: --- !u!114 &406190707 MonoBehaviour: @@ -10131,68 +10131,6 @@ LineRenderer: generateLightingData: 0 m_UseWorldSpace: 0 m_Loop: 0 ---- !u!1001 &1716426162 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 1810220956971058, guid: def06cb2d19a8f74b8f61ea42324f172, type: 3} - propertyPath: m_Name - value: HumanoidPlayer - objectReference: {fileID: 0} - - target: {fileID: 4191195719973714, guid: def06cb2d19a8f74b8f61ea42324f172, type: 3} - propertyPath: m_RootOrder - value: 2 - objectReference: {fileID: 0} - - target: {fileID: 4191195719973714, guid: def06cb2d19a8f74b8f61ea42324f172, type: 3} - propertyPath: m_LocalPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4191195719973714, guid: def06cb2d19a8f74b8f61ea42324f172, type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4191195719973714, guid: def06cb2d19a8f74b8f61ea42324f172, type: 3} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4191195719973714, guid: def06cb2d19a8f74b8f61ea42324f172, type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 4191195719973714, guid: def06cb2d19a8f74b8f61ea42324f172, type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4191195719973714, guid: def06cb2d19a8f74b8f61ea42324f172, type: 3} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4191195719973714, guid: def06cb2d19a8f74b8f61ea42324f172, type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4191195719973714, guid: def06cb2d19a8f74b8f61ea42324f172, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4191195719973714, guid: def06cb2d19a8f74b8f61ea42324f172, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4191195719973714, guid: def06cb2d19a8f74b8f61ea42324f172, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 114636771493283014, guid: def06cb2d19a8f74b8f61ea42324f172, - type: 3} - propertyPath: _debug - value: 1 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: def06cb2d19a8f74b8f61ea42324f172, type: 3} --- !u!1 &1721872685 GameObject: m_ObjectHideFlags: 0