From 839df95722f38c2ac8503e19f994d8e7e8c0e895 Mon Sep 17 00:00:00 2001 From: Harrison Hough Date: Mon, 13 Nov 2023 09:47:06 +0200 Subject: [PATCH 1/9] fix: load in memory if caching disabled --- Runtime/Operations/AvatarDownloader.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Runtime/Operations/AvatarDownloader.cs b/Runtime/Operations/AvatarDownloader.cs index 9a3fdafc..7b771109 100644 --- a/Runtime/Operations/AvatarDownloader.cs +++ b/Runtime/Operations/AvatarDownloader.cs @@ -68,7 +68,7 @@ public async Task Execute(AvatarContext context, CancellationToke AvatarCache.DeleteAvatarModel(context.AvatarUri.Guid, context.ParametersHash); } - if (downloadInMemory) + if (!context.AvatarCachingEnabled || downloadInMemory) { context.Bytes = await DownloadIntoMemory(context.AvatarUri.ModelUrl, context.AvatarConfig, token); return context; From d6ce1f3f570d6e1c0d8b931fecfb6231ae8f7ba0 Mon Sep 17 00:00:00 2001 From: Harrison Date: Mon, 13 Nov 2023 10:54:16 +0200 Subject: [PATCH 2/9] chore: fix for avatar loader window --- .../EditorWindows/AvatarLoaderEditor/AvatarLoaderEditor.cs | 5 +++++ Runtime/Operations/MetadataDownloader.cs | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Editor/UI/EditorWindows/AvatarLoaderEditor/AvatarLoaderEditor.cs b/Editor/UI/EditorWindows/AvatarLoaderEditor/AvatarLoaderEditor.cs index 25a2d483..48ccabe6 100644 --- a/Editor/UI/EditorWindows/AvatarLoaderEditor/AvatarLoaderEditor.cs +++ b/Editor/UI/EditorWindows/AvatarLoaderEditor/AvatarLoaderEditor.cs @@ -119,6 +119,11 @@ private void Completed(object sender, CompletionEventArgs args) } var paramHash = AvatarCache.GetAvatarConfigurationHash(avatarLoaderSettings.AvatarConfig); var path = $"{DirectoryUtility.GetRelativeProjectPath(args.Avatar.name, paramHash)}/{args.Avatar.name}"; + if (!AvatarLoaderSettings.LoadSettings().AvatarCachingEnabled) + { + Debug.LogWarning("Enable Avatar Caching to generate a prefab in the project folder."); + return; + } GameObject avatar = EditorUtilities.CreateAvatarPrefab(args.Metadata, path); if (useEyeAnimations) avatar.AddComponent(); if (useVoiceToAnim) avatar.AddComponent(); diff --git a/Runtime/Operations/MetadataDownloader.cs b/Runtime/Operations/MetadataDownloader.cs index 8e845234..61b0d0bb 100644 --- a/Runtime/Operations/MetadataDownloader.cs +++ b/Runtime/Operations/MetadataDownloader.cs @@ -49,7 +49,7 @@ public async Task Execute(AvatarContext context, CancellationToke { AvatarMetadata metadata = await Download(context.AvatarUri.MetadataUrl, token); context = UpdateContext(context, metadata); - if (context.IsUpdateRequired) + if (context.IsUpdateRequired && context.AvatarCachingEnabled) { SaveMetadataToFile(context); } @@ -91,7 +91,7 @@ private AvatarContext UpdateContext(AvatarContext avatarContext, AvatarMetadata { var message = error.Message; var failureType = error.FailureType; - + if (failureType == FailureType.MetadataParseError) { failureType = error.FailureType; From 8bc4dfc7ed4add5479505f146d6aa5f08caa7230 Mon Sep 17 00:00:00 2001 From: Harrison Date: Mon, 13 Nov 2023 10:59:05 +0200 Subject: [PATCH 3/9] chore: update version number --- Editor/Module Management/ModuleList.cs | 2 +- Runtime/Data/ApplicationData.cs | 2 +- package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Editor/Module Management/ModuleList.cs b/Editor/Module Management/ModuleList.cs index 76b306f4..aa1e1c75 100644 --- a/Editor/Module Management/ModuleList.cs +++ b/Editor/Module Management/ModuleList.cs @@ -14,7 +14,7 @@ public static class ModuleList name = "com.readyplayerme.core", gitUrl = "https://github.com/readyplayerme/rpm-unity-sdk-core.git", branch = "", - version = "4.0.0" + version = "4.0.1" }; /// diff --git a/Runtime/Data/ApplicationData.cs b/Runtime/Data/ApplicationData.cs index bbc9106e..71d37f09 100644 --- a/Runtime/Data/ApplicationData.cs +++ b/Runtime/Data/ApplicationData.cs @@ -6,7 +6,7 @@ namespace ReadyPlayerMe.Core { public static class ApplicationData { - private const string SDK_VERSION = "v4.0.0"; + private const string SDK_VERSION = "v4.0.1"; private const string TAG = "ApplicationData"; private const string DEFAULT_RENDER_PIPELINE = "Built-In Render Pipeline"; private static readonly AppData Data; diff --git a/package.json b/package.json index 20486fa2..869e440a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "com.readyplayerme.core", - "version": "4.0.0", + "version": "4.0.1", "displayName": "Ready Player Me Core", "description": "This Module contains all the core functionality required for using Ready Player Me avatars in Unity, including features such as: \n - Module management and automatic package setup logic\n - Avatar loading from .glb files \n - Avatar creation \n - Avatar and 2D render requests \n - Optional Analytics\n - Custom editor windows\n - Sample scenes and assets", "unity": "2020.3", From c0394772c2abcd73e5f79cd8b3c5b5a670b4ec7b Mon Sep 17 00:00:00 2001 From: Harrison Date: Mon, 13 Nov 2023 11:04:08 +0200 Subject: [PATCH 4/9] chore: clean unused property --- .github/latest.md | 9 +-------- .../AvatarLoaderEditor/AvatarLoaderEditor.cs | 1 - Runtime/AvatarObjectLoader.cs | 3 --- Runtime/Operations/AvatarDownloader.cs | 1 + 4 files changed, 2 insertions(+), 12 deletions(-) diff --git a/.github/latest.md b/.github/latest.md index 07e09e88..280ebe4b 100644 --- a/.github/latest.md +++ b/.github/latest.md @@ -2,11 +2,4 @@ ## Changelog ### Breaking Changes -- Merge avatar creator into core by @ryuuk in [#135](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/135). -- AvatarProcessor no longer searches and replaces existing avatar by @rk132 in [#138](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/138) - -### Added -- show Avatar Creator sample button in guide by @ryuuk in [#141](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/141) - -### Updated -- merged related samples into single folders by @harrisonhough in [#139](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/139) +- fixed an issue causing avatars to be stored locally even if caching was disabled by @harrisonhough in [#149](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/149) \ No newline at end of file diff --git a/Editor/UI/EditorWindows/AvatarLoaderEditor/AvatarLoaderEditor.cs b/Editor/UI/EditorWindows/AvatarLoaderEditor/AvatarLoaderEditor.cs index 48ccabe6..66a053e2 100644 --- a/Editor/UI/EditorWindows/AvatarLoaderEditor/AvatarLoaderEditor.cs +++ b/Editor/UI/EditorWindows/AvatarLoaderEditor/AvatarLoaderEditor.cs @@ -83,7 +83,6 @@ private void LoadAvatar(string url) avatarLoaderSettings = AvatarLoaderSettings.LoadSettings(); } var avatarLoader = new AvatarObjectLoader(); - avatarLoader.SaveInProjectFolder = true; avatarLoader.OnFailed += Failed; avatarLoader.OnCompleted += Completed; avatarLoader.OperationCompleted += OnOperationCompleted; diff --git a/Runtime/AvatarObjectLoader.cs b/Runtime/AvatarObjectLoader.cs index b6c68dac..11041968 100644 --- a/Runtime/AvatarObjectLoader.cs +++ b/Runtime/AvatarObjectLoader.cs @@ -45,9 +45,6 @@ public AvatarObjectLoader(bool useDefaultGLTFDeferAgent = true) } } - /// If true, saves the avatar in the Asset folder. - public bool SaveInProjectFolder { get; set; } - /// Set the timeout for download requests public int Timeout { get; set; } = 20; diff --git a/Runtime/Operations/AvatarDownloader.cs b/Runtime/Operations/AvatarDownloader.cs index 7b771109..08ec6b21 100644 --- a/Runtime/Operations/AvatarDownloader.cs +++ b/Runtime/Operations/AvatarDownloader.cs @@ -53,6 +53,7 @@ public async Task Execute(AvatarContext context, CancellationToke { throw new InvalidDataException($"Expected cast {typeof(string)} instead got "); } + DirectoryUtility.ValidateAvatarSaveDirectory(context.AvatarUri.Guid, context.ParametersHash); if ((!context.IsUpdateRequired || Application.internetReachability == NetworkReachability.NotReachable) From 9cc42582dd320fb5c7e7d06f7002da1f847b77b3 Mon Sep 17 00:00:00 2001 From: Harrison Date: Mon, 13 Nov 2023 11:04:20 +0200 Subject: [PATCH 5/9] chore: updated changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d1b9bb1..080423ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +## [4.0.1] - 2023.11.13 + +### Fixed +- fixed an issue causing avatars to be stored locally even if caching was disabled by @harrisonhough in [#149](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/149) + ## [4.0.0] - 2023.11.01 ### Breaking Changes From b4650a201e15e55cceb5315c349060eb7340b71b Mon Sep 17 00:00:00 2001 From: Harrison Date: Mon, 13 Nov 2023 11:20:21 +0200 Subject: [PATCH 6/9] chore: fix pr link --- .github/latest.md | 2 +- CHANGELOG.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/latest.md b/.github/latest.md index 280ebe4b..2c7d5eed 100644 --- a/.github/latest.md +++ b/.github/latest.md @@ -2,4 +2,4 @@ ## Changelog ### Breaking Changes -- fixed an issue causing avatars to be stored locally even if caching was disabled by @harrisonhough in [#149](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/149) \ No newline at end of file +- fixed an issue causing avatars to be stored locally even if caching was disabled by @harrisonhough in [#150](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/150) \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 080423ae..e9ac20b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). ## [4.0.1] - 2023.11.13 ### Fixed -- fixed an issue causing avatars to be stored locally even if caching was disabled by @harrisonhough in [#149](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/149) +- fixed an issue causing avatars to be stored locally even if caching was disabled by @harrisonhough in [#150](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/150) ## [4.0.0] - 2023.11.01 From 073473703302cca01ff180f1d7b4bd846693c96e Mon Sep 17 00:00:00 2001 From: Harrison Date: Mon, 13 Nov 2023 11:25:22 +0200 Subject: [PATCH 7/9] chore: small cleanup --- .../EditorWindows/AvatarLoaderEditor/AvatarLoaderEditor.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Editor/UI/EditorWindows/AvatarLoaderEditor/AvatarLoaderEditor.cs b/Editor/UI/EditorWindows/AvatarLoaderEditor/AvatarLoaderEditor.cs index 66a053e2..2de431c3 100644 --- a/Editor/UI/EditorWindows/AvatarLoaderEditor/AvatarLoaderEditor.cs +++ b/Editor/UI/EditorWindows/AvatarLoaderEditor/AvatarLoaderEditor.cs @@ -7,6 +7,7 @@ namespace ReadyPlayerMe.Core.Editor { public class AvatarLoaderEditor : EditorWindow { + private const string TAG = nameof(AvatarLoaderEditor); private const string AVATAR_LOADER = "Avatar Loader"; private const string LOAD_AVATAR_BUTTON = "LoadAvatarButton"; private const string HEADER_LABEL = "HeaderLabel"; @@ -112,6 +113,8 @@ private void Failed(object sender, FailureEventArgs args) private void Completed(object sender, CompletionEventArgs args) { + AnalyticsEditorLogger.EventLogger.LogAvatarLoaded(EditorApplication.timeSinceStartup - startTime); + if (avatarLoaderSettings == null) { avatarLoaderSettings = AvatarLoaderSettings.LoadSettings(); @@ -120,7 +123,7 @@ private void Completed(object sender, CompletionEventArgs args) var path = $"{DirectoryUtility.GetRelativeProjectPath(args.Avatar.name, paramHash)}/{args.Avatar.name}"; if (!AvatarLoaderSettings.LoadSettings().AvatarCachingEnabled) { - Debug.LogWarning("Enable Avatar Caching to generate a prefab in the project folder."); + SDKLogger.LogWarning(TAG, "Enable Avatar Caching to generate a prefab in the project folder."); return; } GameObject avatar = EditorUtilities.CreateAvatarPrefab(args.Metadata, path); @@ -128,7 +131,6 @@ private void Completed(object sender, CompletionEventArgs args) if (useVoiceToAnim) avatar.AddComponent(); DestroyImmediate(args.Avatar, true); Selection.activeObject = avatar; - AnalyticsEditorLogger.EventLogger.LogAvatarLoaded(EditorApplication.timeSinceStartup - startTime); } } } From 5d55f37c4becd7b73c0964305ecfcf992a2c96a8 Mon Sep 17 00:00:00 2001 From: Harrison Date: Mon, 13 Nov 2023 14:21:45 +0200 Subject: [PATCH 8/9] chore: small wording update --- .github/latest.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/latest.md b/.github/latest.md index 2c7d5eed..9e55f694 100644 --- a/.github/latest.md +++ b/.github/latest.md @@ -1,5 +1,5 @@ ## Changelog -### Breaking Changes +### Updates - fixed an issue causing avatars to be stored locally even if caching was disabled by @harrisonhough in [#150](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/150) \ No newline at end of file From 1dbf7e5b14734833201b13fa44eb2cb82f33f21b Mon Sep 17 00:00:00 2001 From: Harrison Hough Date: Tue, 14 Nov 2023 07:38:46 +0200 Subject: [PATCH 9/9] chore: update date --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e9ac20b7..449b7ba4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). -## [4.0.1] - 2023.11.13 +## [4.0.1] - 2023.11.14 ### Fixed - fixed an issue causing avatars to be stored locally even if caching was disabled by @harrisonhough in [#150](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/150)