Skip to content

Commit 79a4ed8

Browse files
committed
Merge branch 'hotfix/v3.2.1' into main
2 parents 779678c + 2371a30 commit 79a4ed8

File tree

5 files changed

+31
-21
lines changed

5 files changed

+31
-21
lines changed

.github/latest.md

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,6 @@
1-
We're excited to introduce the 3.0 release of our Unity package, which merges the Avatar Loader plugin into Core for improved maintenance and package installation. Please note that this update includes breaking changes. We recommend backing up your project and consulting our documentation if you encounter any installation issues. Thank you for your continued support, and we're here to assist throughout the update process.
21

32
## Changelog
43

5-
### Added
6-
- **Breaking:** all scripts and assets from Avatar Loader [#87](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/87)
7-
- module installer now automatically removes Avatar Loader after update [#89](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/89)
8-
- new Integration guide editor window [91](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/91)
4+
### Fixed
5+
- issue of missing mesh references when prefabs were created by avatar loader window
96

10-
### Removed
11-
- **Breaking:** all references to ReadyPlayerMe.AvatarLoader namespace [#87](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/87)
12-
13-
### Updated
14-
- moved GltFast dependent code behind scripting define symbol [#87](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/87)
15-
- avatar config processor now uses new mesh LOD parameter [#90](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/90)
16-
- setup guide window improvements [#91](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/91)

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
All notable changes to this project will be documented in this file.
44
This project adheres to [Semantic Versioning](http://semver.org/).
55

6+
## [3.2.1] - 2023.08.28
7+
8+
### Fixed
9+
- issue of missing mesh references when prefabs were created by avatar loader window
10+
611
## [3.2.0] - 2023.08.24
712

813
### Added

Editor/UI/EditorWindows/AvatarLoaderEditor/AvatarLoaderEditor.cs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,19 +113,17 @@ private void Failed(object sender, FailureEventArgs args)
113113

114114
private void Completed(object sender, CompletionEventArgs args)
115115
{
116-
GameObject avatar = args.Avatar;
117-
118-
if (useEyeAnimations) avatar.AddComponent<EyeAnimationHandler>();
119-
if (useVoiceToAnim) avatar.AddComponent<VoiceHandler>();
120116
if (avatarLoaderSettings == null)
121117
{
122118
avatarLoaderSettings = AvatarLoaderSettings.LoadSettings();
123119
}
124-
125120
var paramHash = AvatarCache.GetAvatarConfigurationHash(avatarLoaderSettings.AvatarConfig);
126-
EditorUtilities.CreatePrefab(avatar, $"{DirectoryUtility.GetRelativeProjectPath(avatar.name, paramHash)}/{avatar.name}.prefab");
127-
128-
Selection.activeObject = args.Avatar;
121+
var path = $"{DirectoryUtility.GetRelativeProjectPath(args.Avatar.name, paramHash)}/{args.Avatar.name}";
122+
GameObject avatar = EditorUtilities.CreateAvatarPrefab(args.Metadata, path);
123+
if (useEyeAnimations) avatar.AddComponent<EyeAnimationHandler>();
124+
if (useVoiceToAnim) avatar.AddComponent<VoiceHandler>();
125+
DestroyImmediate(args.Avatar, true);
126+
Selection.activeObject = avatar;
129127
AnalyticsEditorLogger.EventLogger.LogAvatarLoaded(EditorApplication.timeSinceStartup - startTime);
130128
}
131129
}

Editor/Utils/EditorUtilities.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Text.RegularExpressions;
33
using UnityEditor;
44
using UnityEngine;
5+
using Object = UnityEngine.Object;
56

67
namespace ReadyPlayerMe.Core.Editor
78
{
@@ -39,5 +40,21 @@ public static bool IsUrlShortcodeValid(string urlString)
3940
return !string.IsNullOrEmpty(urlString) &&
4041
(Regex.Match(urlString, SHORT_CODE_REGEX).Length > 0 || Uri.IsWellFormedUriString(urlString, UriKind.Absolute) && urlString.EndsWith(".glb"));
4142
}
43+
44+
public static GameObject CreateAvatarPrefab(AvatarMetadata avatarMetadata, string path)
45+
{
46+
var modelFilePath = $"{path}.glb";
47+
AssetDatabase.Refresh();
48+
Object avatarSource = AssetDatabase.LoadAssetAtPath(modelFilePath, typeof(GameObject));
49+
var newAvatar = (GameObject) PrefabUtility.InstantiatePrefab(avatarSource);
50+
var avatarProcessor = new AvatarProcessor();
51+
PrefabUtility.UnpackPrefabInstance(newAvatar, PrefabUnpackMode.Completely, InteractionMode.AutomatedAction);
52+
avatarProcessor.ProcessAvatar(newAvatar, avatarMetadata);
53+
var avatarData = newAvatar.AddComponent<AvatarData>();
54+
avatarData.AvatarMetadata = avatarMetadata;
55+
avatarData.AvatarId = newAvatar.name;
56+
CreatePrefab(newAvatar, $"{path}.prefab");
57+
return newAvatar;
58+
}
4259
}
4360
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "com.readyplayerme.core",
3-
"version": "3.2.0",
3+
"version": "3.2.1",
44
"displayName": "Ready Player Me Core",
55
"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 and 2D render requests\n - Optional Analytics\n - Custom editor windows\n - Sample scenes and assets",
66
"unity": "2020.3",

0 commit comments

Comments
 (0)