add ready player me POC
This commit is contained in:
+34
@@ -0,0 +1,34 @@
|
||||
using ReadyPlayerMe.Core;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ReadyPlayerMe.Samples.AvatarLoading
|
||||
{
|
||||
/// <summary>
|
||||
/// This class is a simple <see cref="Monobehaviour"/> to serve as an example on how to load Ready Player Me avatars and spawn as a <see cref="GameObject"/> into the scene.
|
||||
/// </summary>
|
||||
public class AvatarLoadingExample : MonoBehaviour
|
||||
{
|
||||
[SerializeField] [Tooltip("Set this to the URL or shortcode of the Ready Player Me Avatar you want to load.")]
|
||||
private string avatarUrl = "https://models.readyplayer.me/638df693d72bffc6fa17943c.glb";
|
||||
|
||||
private GameObject avatar;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
ApplicationData.Log();
|
||||
var avatarLoader = new AvatarObjectLoader();
|
||||
// use the OnCompleted event to set the avatar and setup animator
|
||||
avatarLoader.OnCompleted += (_, args) =>
|
||||
{
|
||||
avatar = args.Avatar;
|
||||
AvatarAnimationHelper.SetupAnimator(args.Metadata, args.Avatar);
|
||||
};
|
||||
avatarLoader.LoadAvatar(avatarUrl);
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
if (avatar != null) Destroy(avatar);
|
||||
}
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5ec678a30bb724ed9999a22a9e41d8af
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 259814
|
||||
packageName: Ready Player Me Avatar and Character Creator
|
||||
packageVersion: 7.3.1
|
||||
assetPath: Assets/Ready Player Me/Core/Samples/AvatarLoadingSamples/AvatarLoading/AvatarLoadingExample.cs
|
||||
uploadId: 704624
|
||||
+2150
File diff suppressed because it is too large
Load Diff
+14
@@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bb69c446634b2d94585694a1dfcffd7e
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 259814
|
||||
packageName: Ready Player Me Avatar and Character Creator
|
||||
packageVersion: 7.3.1
|
||||
assetPath: Assets/Ready Player Me/Core/Samples/AvatarLoadingSamples/AvatarLoading/AvatarLoadingExample.unity
|
||||
uploadId: 704624
|
||||
Reference in New Issue
Block a user