diff --git a/.github/latest.md b/.github/latest.md index 07e09e88..9e55f694 100644 --- a/.github/latest.md +++ b/.github/latest.md @@ -1,12 +1,5 @@ ## 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) +### 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 diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d1b9bb1..449b7ba4 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.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) + ## [4.0.0] - 2023.11.01 ### Breaking Changes 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/Editor/UI/EditorWindows/AvatarLoaderEditor/AvatarLoaderEditor.cs b/Editor/UI/EditorWindows/AvatarLoaderEditor/AvatarLoaderEditor.cs index 25a2d483..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"; @@ -83,7 +84,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; @@ -113,18 +113,24 @@ 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(); } var paramHash = AvatarCache.GetAvatarConfigurationHash(avatarLoaderSettings.AvatarConfig); var path = $"{DirectoryUtility.GetRelativeProjectPath(args.Avatar.name, paramHash)}/{args.Avatar.name}"; + if (!AvatarLoaderSettings.LoadSettings().AvatarCachingEnabled) + { + SDKLogger.LogWarning(TAG, "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(); DestroyImmediate(args.Avatar, true); Selection.activeObject = avatar; - AnalyticsEditorLogger.EventLogger.LogAvatarLoaded(EditorApplication.timeSinceStartup - startTime); } } } 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/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/Runtime/Operations/AvatarDownloader.cs b/Runtime/Operations/AvatarDownloader.cs index 9a3fdafc..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) @@ -68,7 +69,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; 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; 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",