From c512dd42c356b54027603b3910f1db4cd5841219 Mon Sep 17 00:00:00 2001 From: Pascal Serrarens Date: Mon, 21 Feb 2022 15:30:32 +0100 Subject: [PATCH] Fix loading possesable avatar by name --- Runtime/Visitors/Scripts/VisitorPossessions.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Runtime/Visitors/Scripts/VisitorPossessions.cs b/Runtime/Visitors/Scripts/VisitorPossessions.cs index 0abee0e..7a96146 100644 --- a/Runtime/Visitors/Scripts/VisitorPossessions.cs +++ b/Runtime/Visitors/Scripts/VisitorPossessions.cs @@ -298,8 +298,17 @@ namespace Passer { yield break; } + string possessableName = possessablePath; + int lastSlashIx = possessablePath.LastIndexOf('/'); + if (lastSlashIx >= 0) + possessableName = possessablePath.Substring( + 1); + //string[] assetPaths = assetBundle.GetAllAssetNames(); + //foreach (string assetPath in assetPaths) { + // Debug.Log(" " + assetPath); + //} + Debug.Log("Load: " + possessablePath); - prefab = assetBundle.LoadAsset(possessablePath); + prefab = assetBundle.LoadAsset(possessableName); // possessablePath); if (prefab == null) { Debug.LogError("Could not load " + possessablePath); yield break;