diff --git a/Runtime/AvatarCreator/AvatarManager.cs b/Runtime/AvatarCreator/AvatarManager.cs index 5aa46d29..d844c283 100644 --- a/Runtime/AvatarCreator/AvatarManager.cs +++ b/Runtime/AvatarCreator/AvatarManager.cs @@ -13,7 +13,6 @@ namespace ReadyPlayerMe.AvatarCreator public class AvatarManager : IDisposable { private const string TAG = nameof(AvatarManager); - private readonly BodyType bodyType; private readonly AvatarAPIRequests avatarAPIRequests; private readonly string avatarConfigParameters; private readonly InCreatorAvatarLoader inCreatorAvatarLoader; @@ -24,13 +23,10 @@ public class AvatarManager : IDisposable public string AvatarId => avatarId; private string avatarId; - /// Body type of avatar /// Config for downloading preview avatar /// Cancellation token - public AvatarManager(BodyType bodyType, AvatarConfig avatarConfig = null, CancellationToken token = default) + public AvatarManager(AvatarConfig avatarConfig = null, CancellationToken token = default) { - this.bodyType = bodyType; - if (avatarConfig != null) { avatarConfigParameters = AvatarConfigProcessor.ProcessAvatarConfiguration(avatarConfig); @@ -46,7 +42,7 @@ public AvatarManager(BodyType bodyType, AvatarConfig avatarConfig = null, Cancel /// /// Properties which describes avatar /// Avatar gameObject - public async Task<(GameObject, AvatarProperties)> CreateAvatar(AvatarProperties avatarProperties) + public async Task<(GameObject avatarGameObject, AvatarProperties avatarProperties)> CreateAvatar(AvatarProperties avatarProperties) { GameObject avatar = null; try @@ -59,7 +55,7 @@ public AvatarManager(BodyType bodyType, AvatarConfig avatarConfig = null, Cancel } avatarId = avatarProperties.Id; - avatar = await GetAvatar(avatarId, true); + avatar = await GetAvatar(avatarId, avatarProperties.BodyType, true); } catch (Exception e) { @@ -75,7 +71,7 @@ public AvatarManager(BodyType bodyType, AvatarConfig avatarConfig = null, Cancel /// /// Template id /// Avatar gameObject - public async Task<(GameObject, AvatarProperties)> CreateAvatarFromTemplate(string id) + public async Task<(GameObject, AvatarProperties)> CreateAvatarFromTemplate(string id, BodyType bodyType) { GameObject avatar = null; var avatarProperties = new AvatarProperties(); @@ -93,7 +89,7 @@ public AvatarManager(BodyType bodyType, AvatarConfig avatarConfig = null, Cancel } avatarId = avatarProperties.Id; - avatar = await GetAvatar(avatarId, true); + avatar = await GetAvatar(avatarId, bodyType, true); } catch (Exception e) { @@ -138,7 +134,7 @@ public async void PrecompileAvatar(string id, PrecompileData precompileData) /// Avatar id /// Whether its a preview avatar /// Avatar gameObject - public async Task GetAvatar(string id, bool isPreview = false) + public async Task GetAvatar(string id, BodyType bodyType, bool isPreview = false) { avatarId = id; byte[] data; @@ -166,7 +162,7 @@ public async Task GetAvatar(string id, bool isPreview = false) /// /// /// Avatar gameObject - public async Task UpdateAsset(Category category, object assetId) + public async Task UpdateAsset(Category category,BodyType bodyType, object assetId) { var payload = new AvatarProperties { diff --git a/Runtime/AvatarCreator/Elements.meta b/Runtime/AvatarCreator/Elements.meta deleted file mode 100644 index 2729d6a8..00000000 --- a/Runtime/AvatarCreator/Elements.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: a0d9288cdb8da8c4b844f9c14d9385f7 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Runtime/AvatarCreator/Elements/ImageConfirmationElement.cs b/Runtime/AvatarCreator/Elements/ImageConfirmationElement.cs deleted file mode 100644 index 6df7e0a4..00000000 --- a/Runtime/AvatarCreator/Elements/ImageConfirmationElement.cs +++ /dev/null @@ -1,24 +0,0 @@ -using UnityEngine; -using UnityEngine.Events; -using UnityEngine.UI; - -public class ImageConfirmationElement : MonoBehaviour -{ - [Header("Settings")] - [SerializeField] private RawImage imageTextureTarget; - - [Header("Events")] - public UnityEvent onImageConfirmed; - - public void SetTexture(Texture2D texture) - { - imageTextureTarget.texture = texture; - } - - public void ConfirmPhoto() - { - var texture = new Texture2D(imageTextureTarget.texture.width, imageTextureTarget.texture.height, TextureFormat.ARGB32, false); - - onImageConfirmed?.Invoke(texture); - } -} diff --git a/Runtime/AvatarCreator/Elements/PhotoCaptureElement.cs b/Runtime/AvatarCreator/Elements/PhotoCaptureElement.cs deleted file mode 100644 index 5566d3a0..00000000 --- a/Runtime/AvatarCreator/Elements/PhotoCaptureElement.cs +++ /dev/null @@ -1,78 +0,0 @@ -using System.Linq; -using UnityEngine; -using UnityEngine.Events; -using UnityEngine.UI; - -public class PhotoCaptureElement : MonoBehaviour -{ - [Header("Settings")] - [SerializeField] private RawImage cameraTextureTarget; - - [Space(5)] - [Header("Events")] - public UnityEvent onPhotoCaptured; - - private WebCamTexture cameraTexture; - - private void Awake() - { - InitializeCamera(); - } - - public void StartCamera() - { - if (cameraTexture != null && !cameraTexture.isPlaying) - { - cameraTexture.Play(); - } - } - - public void StopCamera() - { - if (cameraTexture != null && cameraTexture.isPlaying) - { - cameraTexture.Stop(); - } - } - - public void TakePhoto() - { - if (cameraTexture == null || !cameraTexture.isPlaying) - return; - - var texture = new Texture2D(cameraTextureTarget.texture.width, cameraTextureTarget.texture.height, TextureFormat.ARGB32, false); - texture.SetPixels(cameraTexture.GetPixels()); - texture.Apply(); - - StopCamera(); - - onPhotoCaptured?.Invoke(texture); - } - - private void InitializeCamera() - { - var webCamDevice = GetWebCamDevice(); - - SetupPhotoBoothTexture(webCamDevice?.name); - StartCamera(); - } - - private void SetupPhotoBoothTexture(string textureName) - { - var size = cameraTextureTarget.rectTransform.sizeDelta; - cameraTexture = new WebCamTexture(textureName, (int) size.x, (int) size.y); - cameraTextureTarget.texture = cameraTexture; - } - - private static WebCamDevice? GetWebCamDevice() - { - var devices = WebCamTexture.devices; - - if (devices.Length == 0) - return null; - - var webCamDevice = devices.FirstOrDefault(device => device.isFrontFacing); - - return webCamDevice.Equals(default(WebCamDevice)) ? devices[0] : webCamDevice; - } -} diff --git a/Samples~/AvatarCreatorSamples/Prefabs/Elements/PhotoCaptureWithRetakeElement.prefab b/Runtime/AvatarCreator/Prefabs/PhotoCaptureElement.prefab similarity index 86% rename from Samples~/AvatarCreatorSamples/Prefabs/Elements/PhotoCaptureWithRetakeElement.prefab rename to Runtime/AvatarCreator/Prefabs/PhotoCaptureElement.prefab index 8021be04..6a8af5ca 100644 --- a/Samples~/AvatarCreatorSamples/Prefabs/Elements/PhotoCaptureWithRetakeElement.prefab +++ b/Runtime/AvatarCreator/Prefabs/PhotoCaptureElement.prefab @@ -28,8 +28,7 @@ RectTransform: m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: - - {fileID: 5420710658170928554} + m_Children: [] m_Father: {fileID: 1797080418865859581} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -103,7 +102,7 @@ RectTransform: m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - - {fileID: 3170954159863822515} + - {fileID: 3587631834649243473} m_Father: {fileID: 587931286270194032} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -140,7 +139,7 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_Sprite: {fileID: 21300000, guid: 4d267838cc649284dac0e347a0072f24, type: 3} + m_Sprite: {fileID: 0} m_Type: 0 m_PreserveAspect: 0 m_FillCenter: 1 @@ -171,7 +170,7 @@ MonoBehaviour: m_SelectOnRight: {fileID: 0} m_Transition: 1 m_Colors: - m_NormalColor: {r: 1, g: 1, b: 1, a: 0} + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} m_HighlightedColor: {r: 0.7960785, g: 0.8352942, b: 0.87843144, a: 1} m_PressedColor: {r: 0.6226415, g: 0.61383057, b: 0.61383057, a: 1} m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} @@ -276,81 +275,6 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 587931286270194033} m_CullTransparentMesh: 1 ---- !u!1 &2951325802988831501 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 3170954159863822515} - - component: {fileID: 1246865036225759354} - - component: {fileID: 5907589380475161792} - m_Layer: 5 - m_Name: Image - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &3170954159863822515 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2951325802988831501} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 587931286161632659} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} - m_Pivot: {x: 0.5, y: 0.5} ---- !u!222 &1246865036225759354 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2951325802988831501} - m_CullTransparentMesh: 1 ---- !u!114 &5907589380475161792 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2951325802988831501} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Material: {fileID: 0} - m_Color: {r: 1, g: 1, b: 1, a: 1} - m_RaycastTarget: 0 - m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} - m_Maskable: 1 - m_OnCullStateChanged: - m_PersistentCalls: - m_Calls: [] - m_Sprite: {fileID: 21300000, guid: d020c3e52591eac448703b64931cfc69, type: 3} - m_Type: 0 - m_PreserveAspect: 0 - m_FillCenter: 1 - m_FillMethod: 4 - m_FillAmount: 1 - m_FillClockwise: 1 - m_FillOrigin: 0 - m_UseSpriteMesh: 0 - m_PixelsPerUnitMultiplier: 1 --- !u!1 &3070902759609564265 GameObject: m_ObjectHideFlags: 0 @@ -362,7 +286,7 @@ GameObject: - component: {fileID: 3839650676573825916} - component: {fileID: 3070902759609564279} m_Layer: 5 - m_Name: PhotoCaptureWithRetakeElement + m_Name: PhotoCaptureElement m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -480,7 +404,7 @@ MonoBehaviour: m_EditorClassIdentifier: m_Padding: {x: 0, y: 0, z: 0, w: 0} m_Softness: {x: 0, y: 0} ---- !u!1 &7461952888254498879 +--- !u!1 &6677586027879493572 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -488,28 +412,28 @@ GameObject: m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - - component: {fileID: 5420710658170928554} - - component: {fileID: 1559830376274619932} - - component: {fileID: 8966798247899462567} + - component: {fileID: 3587631834649243473} + - component: {fileID: 4712182501636505251} + - component: {fileID: 2435727913369542382} m_Layer: 5 - m_Name: Border + m_Name: Text m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!224 &5420710658170928554 +--- !u!224 &3587631834649243473 RectTransform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7461952888254498879} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_GameObject: {fileID: 6677586027879493572} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] - m_Father: {fileID: 587931285558771091} + m_Father: {fileID: 587931286161632659} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} @@ -517,44 +441,48 @@ RectTransform: m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} ---- !u!222 &1559830376274619932 +--- !u!222 &4712182501636505251 CanvasRenderer: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7461952888254498879} + m_GameObject: {fileID: 6677586027879493572} m_CullTransparentMesh: 1 ---- !u!114 &8966798247899462567 +--- !u!114 &2435727913369542382 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7461952888254498879} + m_GameObject: {fileID: 6677586027879493572} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} - m_Color: {r: 1, g: 1, b: 1, a: 1} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} m_RaycastTarget: 1 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_Sprite: {fileID: 21300000, guid: f3be935944ee4754d8d71cdf47dea555, type: 3} - m_Type: 1 - m_PreserveAspect: 0 - m_FillCenter: 0 - m_FillMethod: 4 - m_FillAmount: 1 - m_FillClockwise: 1 - m_FillOrigin: 0 - m_UseSpriteMesh: 0 - m_PixelsPerUnitMultiplier: 10 + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 20 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 2 + m_MaxSize: 40 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "Take \nA\nPhoto !" --- !u!1 &8697743728154652220 GameObject: m_ObjectHideFlags: 0 @@ -952,8 +880,7 @@ RectTransform: m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: - - {fileID: 8697743729462792731} + m_Children: [] m_Father: {fileID: 8697743729874582683} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -1057,6 +984,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 696f4cf6c3c6d434b8ab068afc2a8758, type: 3} m_Name: m_EditorClassIdentifier: + imageTextureTarget: {fileID: 8697743728774678111} onImageConfirmed: m_PersistentCalls: m_Calls: @@ -1072,82 +1000,6 @@ MonoBehaviour: m_StringArgument: m_BoolArgument: 0 m_CallState: 2 - imageTextureTarget: {fileID: 8697743728774678111} ---- !u!1 &8697743729462792730 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 8697743729462792731} - - component: {fileID: 8697743729462792725} - - component: {fileID: 8697743729462792724} - m_Layer: 5 - m_Name: Border - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &8697743729462792731 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8697743729462792730} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 8697743728774678105} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} - m_Pivot: {x: 0.5, y: 0.5} ---- !u!222 &8697743729462792725 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8697743729462792730} - m_CullTransparentMesh: 1 ---- !u!114 &8697743729462792724 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8697743729462792730} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Material: {fileID: 0} - m_Color: {r: 1, g: 1, b: 1, a: 1} - m_RaycastTarget: 1 - m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} - m_Maskable: 1 - m_OnCullStateChanged: - m_PersistentCalls: - m_Calls: [] - m_Sprite: {fileID: 21300000, guid: f3be935944ee4754d8d71cdf47dea555, type: 3} - m_Type: 1 - m_PreserveAspect: 0 - m_FillCenter: 0 - m_FillMethod: 4 - m_FillAmount: 1 - m_FillClockwise: 1 - m_FillOrigin: 0 - m_UseSpriteMesh: 0 - m_PixelsPerUnitMultiplier: 10 --- !u!1 &8697743729846645719 GameObject: m_ObjectHideFlags: 0 diff --git a/Samples~/AvatarCreatorSamples/Prefabs/Elements/PhotoCaptureWithRetakeElement.prefab.meta b/Runtime/AvatarCreator/Prefabs/PhotoCaptureElement.prefab.meta similarity index 100% rename from Samples~/AvatarCreatorSamples/Prefabs/Elements/PhotoCaptureWithRetakeElement.prefab.meta rename to Runtime/AvatarCreator/Prefabs/PhotoCaptureElement.prefab.meta diff --git a/Runtime/AvatarCreator/Prefabs/Selfie Element.prefab b/Runtime/AvatarCreator/Prefabs/Selfie Element.prefab new file mode 100644 index 00000000..51f72ca8 --- /dev/null +++ b/Runtime/AvatarCreator/Prefabs/Selfie Element.prefab @@ -0,0 +1,528 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &775183974563834942 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2286514047112729027} + - component: {fileID: 5390014693613972149} + - component: {fileID: 3396316235823507953} + - component: {fileID: 2208471112237398821} + m_Layer: 5 + m_Name: 'PhotoButton ' + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2286514047112729027 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 775183974563834942} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1689631511617245488} + m_Father: {fileID: 3398117271558717675} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 420, y: 60} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &5390014693613972149 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 775183974563834942} + m_CullTransparentMesh: 1 +--- !u!114 &3396316235823507953 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 775183974563834942} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &2208471112237398821 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 775183974563834942} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 3396316235823507953} + m_OnClick: + m_PersistentCalls: + m_Calls: + - m_Target: {fileID: 3398117271558717672} + m_TargetAssemblyTypeName: UnityEngine.GameObject, UnityEngine + m_MethodName: SetActive + m_Mode: 6 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 + - m_Target: {fileID: 6795999165145603437} + m_TargetAssemblyTypeName: UnityEngine.GameObject, UnityEngine + m_MethodName: SetActive + m_Mode: 6 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 1 + m_CallState: 2 +--- !u!1 &3398117271558717672 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3398117271558717675} + - component: {fileID: 3398117271558717669} + - component: {fileID: 3398117271558717674} + m_Layer: 5 + m_Name: Panel + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &3398117271558717675 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3398117271558717672} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 2286514047112729027} + m_Father: {fileID: 4316720321970040649} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &3398117271558717669 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3398117271558717672} + m_CullTransparentMesh: 1 +--- !u!114 &3398117271558717674 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3398117271558717672} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0, g: 0, b: 0, a: 0.392} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &3683891522026914081 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1689631511617245488} + - component: {fileID: 3381257557372177120} + - component: {fileID: 8107261797535056279} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1689631511617245488 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3683891522026914081} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 2286514047112729027} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &3381257557372177120 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3683891522026914081} + m_CullTransparentMesh: 1 +--- !u!114 &8107261797535056279 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3683891522026914081} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 39 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 80 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Take a Photo +--- !u!1 &4316720321970040646 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4316720321970040649} + - component: {fileID: 1361592108061403732} + m_Layer: 5 + m_Name: Selfie Element + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &4316720321970040649 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4316720321970040646} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 3398117271558717675} + - {fileID: 4721770237493824120} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 1024, y: 768} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1361592108061403732 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4316720321970040646} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 99bd9211dcb8ae24f90bc5a39139e834, type: 3} + m_Name: + m_EditorClassIdentifier: + bodyType: 1 + gender: 1 + onAvatarCreated: + m_PersistentCalls: + m_Calls: [] +--- !u!1001 &8416722967489257732 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 4316720321970040649} + m_Modifications: + - target: {fileID: 3070902759609564265, guid: 40dfe16256c5abc49836d4217815ea88, + type: 3} + propertyPath: m_Name + value: PhotoCaptureElement + objectReference: {fileID: 0} + - target: {fileID: 3070902759609564265, guid: 40dfe16256c5abc49836d4217815ea88, + type: 3} + propertyPath: m_IsActive + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3070902759609564279, guid: 40dfe16256c5abc49836d4217815ea88, + type: 3} + propertyPath: onPhotoCaptured.m_PersistentCalls.m_Calls.Array.size + value: 3 + objectReference: {fileID: 0} + - target: {fileID: 3070902759609564279, guid: 40dfe16256c5abc49836d4217815ea88, + type: 3} + propertyPath: onPhotoCaptured.m_PersistentCalls.m_Calls.Array.data[2].m_Target + value: + objectReference: {fileID: 1361592108061403732} + - target: {fileID: 3070902759609564279, guid: 40dfe16256c5abc49836d4217815ea88, + type: 3} + propertyPath: onPhotoCaptured.m_PersistentCalls.m_Calls.Array.data[2].m_CallState + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 3070902759609564279, guid: 40dfe16256c5abc49836d4217815ea88, + type: 3} + propertyPath: onPhotoCaptured.m_PersistentCalls.m_Calls.Array.data[2].m_MethodName + value: OnPhotoCaptured + objectReference: {fileID: 0} + - target: {fileID: 3070902759609564279, guid: 40dfe16256c5abc49836d4217815ea88, + type: 3} + propertyPath: onPhotoCaptured.m_PersistentCalls.m_Calls.Array.data[2].m_TargetAssemblyTypeName + value: ReadyPlayerMe.AvatarCreator.SelfieElement, ReadyPlayerMe.Core.AvatarCreator + objectReference: {fileID: 0} + - target: {fileID: 3070902759609564279, guid: 40dfe16256c5abc49836d4217815ea88, + type: 3} + propertyPath: onPhotoCaptured.m_PersistentCalls.m_Calls.Array.data[2].m_Arguments.m_BoolArgument + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 3070902759609564279, guid: 40dfe16256c5abc49836d4217815ea88, + type: 3} + propertyPath: onPhotoCaptured.m_PersistentCalls.m_Calls.Array.data[2].m_Arguments.m_ObjectArgumentAssemblyTypeName + value: UnityEngine.Object, UnityEngine + objectReference: {fileID: 0} + - target: {fileID: 3839650676573825916, guid: 40dfe16256c5abc49836d4217815ea88, + type: 3} + propertyPath: m_Pivot.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 3839650676573825916, guid: 40dfe16256c5abc49836d4217815ea88, + type: 3} + propertyPath: m_Pivot.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 3839650676573825916, guid: 40dfe16256c5abc49836d4217815ea88, + type: 3} + propertyPath: m_RootOrder + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 3839650676573825916, guid: 40dfe16256c5abc49836d4217815ea88, + type: 3} + propertyPath: m_AnchorMax.x + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 3839650676573825916, guid: 40dfe16256c5abc49836d4217815ea88, + type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 3839650676573825916, guid: 40dfe16256c5abc49836d4217815ea88, + type: 3} + propertyPath: m_AnchorMin.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3839650676573825916, guid: 40dfe16256c5abc49836d4217815ea88, + type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3839650676573825916, guid: 40dfe16256c5abc49836d4217815ea88, + type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3839650676573825916, guid: 40dfe16256c5abc49836d4217815ea88, + type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3839650676573825916, guid: 40dfe16256c5abc49836d4217815ea88, + type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3839650676573825916, guid: 40dfe16256c5abc49836d4217815ea88, + type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3839650676573825916, guid: 40dfe16256c5abc49836d4217815ea88, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3839650676573825916, guid: 40dfe16256c5abc49836d4217815ea88, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 3839650676573825916, guid: 40dfe16256c5abc49836d4217815ea88, + type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3839650676573825916, guid: 40dfe16256c5abc49836d4217815ea88, + type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3839650676573825916, guid: 40dfe16256c5abc49836d4217815ea88, + type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3839650676573825916, guid: 40dfe16256c5abc49836d4217815ea88, + type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3839650676573825916, guid: 40dfe16256c5abc49836d4217815ea88, + type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3839650676573825916, guid: 40dfe16256c5abc49836d4217815ea88, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3839650676573825916, guid: 40dfe16256c5abc49836d4217815ea88, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3839650676573825916, guid: 40dfe16256c5abc49836d4217815ea88, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 40dfe16256c5abc49836d4217815ea88, type: 3} +--- !u!1 &6795999165145603437 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 3070902759609564265, guid: 40dfe16256c5abc49836d4217815ea88, + type: 3} + m_PrefabInstance: {fileID: 8416722967489257732} + m_PrefabAsset: {fileID: 0} +--- !u!224 &4721770237493824120 stripped +RectTransform: + m_CorrespondingSourceObject: {fileID: 3839650676573825916, guid: 40dfe16256c5abc49836d4217815ea88, + type: 3} + m_PrefabInstance: {fileID: 8416722967489257732} + m_PrefabAsset: {fileID: 0} diff --git a/Samples~/AvatarCreatorSamples/Prefabs/Elements/ImageConfirmationElement.prefab.meta b/Runtime/AvatarCreator/Prefabs/Selfie Element.prefab.meta similarity index 74% rename from Samples~/AvatarCreatorSamples/Prefabs/Elements/ImageConfirmationElement.prefab.meta rename to Runtime/AvatarCreator/Prefabs/Selfie Element.prefab.meta index b371aff6..31ece5b9 100644 --- a/Samples~/AvatarCreatorSamples/Prefabs/Elements/ImageConfirmationElement.prefab.meta +++ b/Runtime/AvatarCreator/Prefabs/Selfie Element.prefab.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 103ff3bfd13960446b80fd279d99cc6b +guid: 15486f9397362394a910d24244fdd29b PrefabImporter: externalObjects: {} userData: diff --git a/Runtime/AvatarCreator/UI/ImageConfirmationElement.cs b/Runtime/AvatarCreator/UI/ImageConfirmationElement.cs new file mode 100644 index 00000000..9708f4da --- /dev/null +++ b/Runtime/AvatarCreator/UI/ImageConfirmationElement.cs @@ -0,0 +1,25 @@ +using UnityEngine; +using UnityEngine.Events; +using UnityEngine.UI; + +namespace ReadyPlayerMe.AvatarCreator +{ + public class ImageConfirmationElement : MonoBehaviour + { + [Header("Settings")] + [SerializeField] private RawImage imageTextureTarget; + + [Header("Events")] + public UnityEvent onImageConfirmed; + + public void SetTexture(Texture2D texture) + { + imageTextureTarget.texture = texture; + } + + public void ConfirmPhoto() + { + onImageConfirmed?.Invoke((Texture2D)imageTextureTarget.texture); + } + } +} diff --git a/Runtime/AvatarCreator/Elements/ImageConfirmationElement.cs.meta b/Runtime/AvatarCreator/UI/ImageConfirmationElement.cs.meta similarity index 100% rename from Runtime/AvatarCreator/Elements/ImageConfirmationElement.cs.meta rename to Runtime/AvatarCreator/UI/ImageConfirmationElement.cs.meta diff --git a/Runtime/AvatarCreator/UI/PhotoCaptureElement.cs b/Runtime/AvatarCreator/UI/PhotoCaptureElement.cs new file mode 100644 index 00000000..1d14da3e --- /dev/null +++ b/Runtime/AvatarCreator/UI/PhotoCaptureElement.cs @@ -0,0 +1,93 @@ +using System.Linq; +using UnityEngine; +using UnityEngine.Events; +using UnityEngine.UI; + +namespace ReadyPlayerMe.AvatarCreator +{ + public class PhotoCaptureElement : MonoBehaviour + { + [Header("Settings")] + [SerializeField] private RawImage cameraTextureTarget; + [SerializeField] private bool initializeOnEnable = true; + + [Space(5)] + [Header("Events")] + public UnityEvent onPhotoCaptured; + + private WebCamTexture cameraTexture; + private bool isInitialized; + + private void OnEnable() + { + if (initializeOnEnable) + { + StartCamera(); + } + } + + private void OnDisable() + { + StopCamera(); + } + + public void StartCamera() + { + if (!isInitialized) + { + InitializeCamera(); + } + + if (cameraTexture != null && !cameraTexture.isPlaying) + { + cameraTexture.Play(); + } + } + + public void StopCamera() + { + if (cameraTexture != null && cameraTexture.isPlaying) + { + cameraTexture.Stop(); + } + } + + public void TakePhoto() + { + if (cameraTexture == null || !cameraTexture.isPlaying) + return; + + var texture = new Texture2D(cameraTextureTarget.texture.width, cameraTextureTarget.texture.height, TextureFormat.ARGB32, false); + texture.SetPixels(cameraTexture.GetPixels()); + texture.Apply(); + + onPhotoCaptured?.Invoke(texture); + } + + private void InitializeCamera() + { + var webCamDevice = GetWebCamDevice(); + SetupPhotoBoothTexture(webCamDevice?.name); + isInitialized = true; + } + + private void SetupPhotoBoothTexture(string textureName) + { + var size = cameraTextureTarget.rectTransform.sizeDelta; + cameraTexture = new WebCamTexture(textureName, (int) size.x, (int) size.y); + cameraTextureTarget.texture = cameraTexture; + } + + private static WebCamDevice? GetWebCamDevice() + { + var devices = WebCamTexture.devices; + + if (devices.Length == 0) + return null; + + var webCamDevice = devices.FirstOrDefault(device => device.isFrontFacing); + + return webCamDevice.Equals(default(WebCamDevice)) ? devices[0] : webCamDevice; + } + } +} diff --git a/Runtime/AvatarCreator/Elements/PhotoCaptureElement.cs.meta b/Runtime/AvatarCreator/UI/PhotoCaptureElement.cs.meta similarity index 100% rename from Runtime/AvatarCreator/Elements/PhotoCaptureElement.cs.meta rename to Runtime/AvatarCreator/UI/PhotoCaptureElement.cs.meta diff --git a/Runtime/AvatarCreator/UI/SelfieToAvatarElement.cs b/Runtime/AvatarCreator/UI/SelfieToAvatarElement.cs new file mode 100644 index 00000000..4b7c7563 --- /dev/null +++ b/Runtime/AvatarCreator/UI/SelfieToAvatarElement.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using ReadyPlayerMe.Core; +using UnityEngine; +using UnityEngine.Events; + +namespace ReadyPlayerMe.AvatarCreator +{ + public class SelfieToAvatarElement : MonoBehaviour + { + private const string TAG = nameof(SelfieToAvatarElement); + + [SerializeField] private BodyType bodyType; + [SerializeField] private OutfitGender gender; + [SerializeField] private AvatarConfig avatarConfig; + + [Space(5)] + [Header("Events")] + public UnityEvent onAvatarCreated; + + public async void OnPhotoCaptured(Texture2D texture) + { + var bytes = texture.EncodeToPNG(); + var byteAsString = Convert.ToBase64String(bytes); + + var avatarProperties = new AvatarProperties(); + avatarProperties.Partner = CoreSettingsHandler.CoreSettings.Subdomain; + avatarProperties.Base64Image = byteAsString; + avatarProperties.BodyType = bodyType; + avatarProperties.Gender = gender; + avatarProperties.Assets = new Dictionary(); + + if (!AuthManager.IsSignedIn && !AuthManager.IsSignedInAnonymously) + { + SDKLogger.Log(TAG, "Not signed in"); + return; + } + + var avatarManager = new AvatarManager(avatarConfig); + var avatar = await avatarManager.CreateAvatar(avatarProperties); + + onAvatarCreated?.Invoke(avatar.avatarGameObject, avatar.avatarProperties); + } + } +} diff --git a/Runtime/AvatarCreator/UI/SelfieToAvatarElement.cs.meta b/Runtime/AvatarCreator/UI/SelfieToAvatarElement.cs.meta new file mode 100644 index 00000000..73f7c8a0 --- /dev/null +++ b/Runtime/AvatarCreator/UI/SelfieToAvatarElement.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 99bd9211dcb8ae24f90bc5a39139e834 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Samples~/AvatarCreatorSamples/Prefabs/Elements.meta b/Samples~/AvatarCreatorSamples/Prefabs/Elements.meta deleted file mode 100644 index 7c723b8b..00000000 --- a/Samples~/AvatarCreatorSamples/Prefabs/Elements.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 2d4100fe9d859994eb8b9536d390e33d -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Samples~/AvatarCreatorSamples/Prefabs/Elements/ImageConfirmationElement.prefab b/Samples~/AvatarCreatorSamples/Prefabs/Elements/ImageConfirmationElement.prefab deleted file mode 100644 index 5f1157bd..00000000 --- a/Samples~/AvatarCreatorSamples/Prefabs/Elements/ImageConfirmationElement.prefab +++ /dev/null @@ -1,488 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!1 &7059655938109072675 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 7059655938109072676} - - component: {fileID: 7059655938109072677} - - component: {fileID: 7059655938109072674} - m_Layer: 5 - m_Name: CameraTextureTarget - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &7059655938109072676 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7059655938109072675} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: - - {fileID: 7059655939553112422} - m_Father: {fileID: 7059655939141853158} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} - m_Pivot: {x: 0.5, y: 0.5} ---- !u!222 &7059655938109072677 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7059655938109072675} - m_CullTransparentMesh: 1 ---- !u!114 &7059655938109072674 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7059655938109072675} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Material: {fileID: 0} - m_Color: {r: 1, g: 1, b: 1, a: 1} - m_RaycastTarget: 1 - m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} - m_Maskable: 1 - m_OnCullStateChanged: - m_PersistentCalls: - m_Calls: [] - m_Texture: {fileID: 2800000, guid: 95badceda28772746855bd8677e9b7dd, type: 3} - m_UVRect: - serializedVersion: 2 - x: 0 - y: 0 - width: 1 - height: 1 ---- !u!1 &7059655938713767233 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 7059655938713767232} - - component: {fileID: 7059655938713767237} - - component: {fileID: 7059655938713767234} - - component: {fileID: 7059655938713767235} - m_Layer: 5 - m_Name: ConfirmPhotoButton - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &7059655938713767232 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7059655938713767233} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: - - {fileID: 7059655939181973677} - m_Father: {fileID: 7059655939902662746} - m_RootOrder: 1 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0.5, y: 1} - m_AnchorMax: {x: 0.5, y: 1} - m_AnchoredPosition: {x: 0, y: -559} - m_SizeDelta: {x: 160, y: 60} - m_Pivot: {x: 0.5, y: 1} ---- !u!222 &7059655938713767237 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7059655938713767233} - m_CullTransparentMesh: 1 ---- !u!114 &7059655938713767234 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7059655938713767233} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Material: {fileID: 0} - m_Color: {r: 1, g: 1, b: 1, a: 1} - m_RaycastTarget: 1 - m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} - m_Maskable: 1 - m_OnCullStateChanged: - m_PersistentCalls: - m_Calls: [] - m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} - m_Type: 1 - m_PreserveAspect: 0 - m_FillCenter: 1 - m_FillMethod: 4 - m_FillAmount: 1 - m_FillClockwise: 1 - m_FillOrigin: 0 - m_UseSpriteMesh: 0 - m_PixelsPerUnitMultiplier: 1 ---- !u!114 &7059655938713767235 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7059655938713767233} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Navigation: - m_Mode: 3 - m_WrapAround: 0 - m_SelectOnUp: {fileID: 0} - m_SelectOnDown: {fileID: 0} - m_SelectOnLeft: {fileID: 0} - m_SelectOnRight: {fileID: 0} - m_Transition: 1 - m_Colors: - m_NormalColor: {r: 1, g: 1, b: 1, a: 1} - m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} - m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} - m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} - m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} - m_ColorMultiplier: 1 - m_FadeDuration: 0.1 - m_SpriteState: - m_HighlightedSprite: {fileID: 0} - m_PressedSprite: {fileID: 0} - m_SelectedSprite: {fileID: 0} - m_DisabledSprite: {fileID: 0} - m_AnimationTriggers: - m_NormalTrigger: Normal - m_HighlightedTrigger: Highlighted - m_PressedTrigger: Pressed - m_SelectedTrigger: Selected - m_DisabledTrigger: Disabled - m_Interactable: 1 - m_TargetGraphic: {fileID: 7059655938713767234} - m_OnClick: - m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 7059655939902662749} - m_TargetAssemblyTypeName: ImageConfirmationElement, ReadyPlayerMe.Core.AvatarCreator - m_MethodName: ConfirmPhoto - m_Mode: 1 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 ---- !u!1 &7059655939141853159 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 7059655939141853158} - - component: {fileID: 7059655939141853161} - m_Layer: 5 - m_Name: CameraView - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &7059655939141853158 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7059655939141853159} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: - - {fileID: 7059655938109072676} - m_Father: {fileID: 7059655939902662746} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0.5, y: 1} - m_AnchorMax: {x: 0.5, y: 1} - m_AnchoredPosition: {x: 0, y: -120} - m_SizeDelta: {x: 800, y: 400} - m_Pivot: {x: 0.5, y: 1} ---- !u!114 &7059655939141853161 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7059655939141853159} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 3312d7739989d2b4e91e6319e9a96d76, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Padding: {x: 0, y: 0, z: 0, w: 0} - m_Softness: {x: 0, y: 0} ---- !u!1 &7059655939181973674 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 7059655939181973677} - - component: {fileID: 7059655939181973679} - - component: {fileID: 7059655939181973676} - m_Layer: 5 - m_Name: Text - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &7059655939181973677 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7059655939181973674} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 7059655938713767232} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} - m_Pivot: {x: 0.5, y: 0.5} ---- !u!222 &7059655939181973679 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7059655939181973674} - m_CullTransparentMesh: 1 ---- !u!114 &7059655939181973676 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7059655939181973674} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Material: {fileID: 0} - m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} - m_RaycastTarget: 1 - m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} - m_Maskable: 1 - m_OnCullStateChanged: - m_PersistentCalls: - m_Calls: [] - m_FontData: - m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} - m_FontSize: 14 - m_FontStyle: 0 - m_BestFit: 0 - m_MinSize: 10 - m_MaxSize: 40 - m_Alignment: 4 - m_AlignByGeometry: 0 - m_RichText: 1 - m_HorizontalOverflow: 0 - m_VerticalOverflow: 0 - m_LineSpacing: 1 - m_Text: Confirm ---- !u!1 &7059655939553112423 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 7059655939553112422} - - component: {fileID: 7059655939553112424} - - component: {fileID: 7059655939553112425} - m_Layer: 5 - m_Name: Border - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &7059655939553112422 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7059655939553112423} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 7059655938109072676} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} - m_Pivot: {x: 0.5, y: 0.5} ---- !u!222 &7059655939553112424 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7059655939553112423} - m_CullTransparentMesh: 1 ---- !u!114 &7059655939553112425 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7059655939553112423} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Material: {fileID: 0} - m_Color: {r: 1, g: 1, b: 1, a: 1} - m_RaycastTarget: 1 - m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} - m_Maskable: 1 - m_OnCullStateChanged: - m_PersistentCalls: - m_Calls: [] - m_Sprite: {fileID: 21300000, guid: f3be935944ee4754d8d71cdf47dea555, type: 3} - m_Type: 1 - m_PreserveAspect: 0 - m_FillCenter: 0 - m_FillMethod: 4 - m_FillAmount: 1 - m_FillClockwise: 1 - m_FillOrigin: 0 - m_UseSpriteMesh: 0 - m_PixelsPerUnitMultiplier: 10 ---- !u!1 &7059655939902662747 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 7059655939902662746} - - component: {fileID: 7059655939902662748} - - component: {fileID: 7059655939902662749} - m_Layer: 5 - m_Name: ImageConfirmationElement - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &7059655939902662746 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7059655939902662747} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: - - {fileID: 7059655939141853158} - - {fileID: 7059655938713767232} - m_Father: {fileID: 0} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} - m_Pivot: {x: 0.5, y: 0.5} ---- !u!222 &7059655939902662748 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7059655939902662747} - m_CullTransparentMesh: 1 ---- !u!114 &7059655939902662749 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7059655939902662747} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 696f4cf6c3c6d434b8ab068afc2a8758, type: 3} - m_Name: - m_EditorClassIdentifier: - onImageConfirmed: - m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 7059655939902662747} - m_TargetAssemblyTypeName: UnityEngine.GameObject, UnityEngine - m_MethodName: SetActive - m_Mode: 6 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 - imageTextureTarget: {fileID: 7059655938109072674} diff --git a/Samples~/AvatarCreatorSamples/Prefabs/Elements/PhotoCaptureElement.prefab b/Samples~/AvatarCreatorSamples/Prefabs/Elements/PhotoCaptureElement.prefab deleted file mode 100644 index 3c9efa68..00000000 --- a/Samples~/AvatarCreatorSamples/Prefabs/Elements/PhotoCaptureElement.prefab +++ /dev/null @@ -1,520 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!1 &7393833530818401161 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 7393833530818401166} - - component: {fileID: 7393833530818401167} - m_Layer: 5 - m_Name: PhotoBoothPanel - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &7393833530818401166 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7393833530818401161} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: - - {fileID: 7393833532474683808} - - {fileID: 7393833532225704346} - m_Father: {fileID: 7393833531132547633} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} - m_Pivot: {x: 0.5, y: 0.5} ---- !u!222 &7393833530818401167 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7393833530818401161} - m_CullTransparentMesh: 1 ---- !u!1 &7393833531132547632 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 7393833531132547633} - - component: {fileID: 7393833531132547638} - m_Layer: 5 - m_Name: PhotoCaptureElement - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &7393833531132547633 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7393833531132547632} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: - - {fileID: 7393833530818401166} - m_Father: {fileID: 0} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} - m_Pivot: {x: 0.5, y: 0.5} ---- !u!114 &7393833531132547638 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7393833531132547632} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: cbd28a49a9d475c44b6330b33b212b42, type: 3} - m_Name: - m_EditorClassIdentifier: - cameraTextureTarget: {fileID: 7393833532473299347} - onPhotoCaptured: - m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 7393833530818401161} - m_TargetAssemblyTypeName: UnityEngine.GameObject, UnityEngine - m_MethodName: SetActive - m_Mode: 6 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 ---- !u!1 &7393833531487950526 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 7393833531487950527} - - component: {fileID: 7393833531487950525} - - component: {fileID: 7393833531487950524} - m_Layer: 5 - m_Name: Image - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &7393833531487950527 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7393833531487950526} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 7393833532225704346} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} - m_Pivot: {x: 0.5, y: 0.5} ---- !u!222 &7393833531487950525 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7393833531487950526} - m_CullTransparentMesh: 1 ---- !u!114 &7393833531487950524 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7393833531487950526} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Material: {fileID: 0} - m_Color: {r: 1, g: 1, b: 1, a: 1} - m_RaycastTarget: 0 - m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} - m_Maskable: 1 - m_OnCullStateChanged: - m_PersistentCalls: - m_Calls: [] - m_Sprite: {fileID: 21300000, guid: d020c3e52591eac448703b64931cfc69, type: 3} - m_Type: 0 - m_PreserveAspect: 0 - m_FillCenter: 1 - m_FillMethod: 4 - m_FillAmount: 1 - m_FillClockwise: 1 - m_FillOrigin: 0 - m_UseSpriteMesh: 0 - m_PixelsPerUnitMultiplier: 1 ---- !u!1 &7393833532225704357 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 7393833532225704346} - - component: {fileID: 7393833532225704345} - - component: {fileID: 7393833532225704344} - - component: {fileID: 7393833532225704347} - m_Layer: 5 - m_Name: TakePhotoButton - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &7393833532225704346 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7393833532225704357} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: - - {fileID: 7393833531487950527} - m_Father: {fileID: 7393833530818401166} - m_RootOrder: 1 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0.5, y: 1} - m_AnchorMax: {x: 0.5, y: 1} - m_AnchoredPosition: {x: 0, y: -560} - m_SizeDelta: {x: 100, y: 100} - m_Pivot: {x: 0.5, y: 1} ---- !u!222 &7393833532225704345 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7393833532225704357} - m_CullTransparentMesh: 1 ---- !u!114 &7393833532225704344 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7393833532225704357} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Material: {fileID: 0} - m_Color: {r: 0.7960785, g: 0.8352942, b: 0.87843144, a: 1} - m_RaycastTarget: 1 - m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} - m_Maskable: 1 - m_OnCullStateChanged: - m_PersistentCalls: - m_Calls: [] - m_Sprite: {fileID: 21300000, guid: 4d267838cc649284dac0e347a0072f24, type: 3} - m_Type: 0 - m_PreserveAspect: 0 - m_FillCenter: 1 - m_FillMethod: 4 - m_FillAmount: 1 - m_FillClockwise: 1 - m_FillOrigin: 0 - m_UseSpriteMesh: 0 - m_PixelsPerUnitMultiplier: 3 ---- !u!114 &7393833532225704347 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7393833532225704357} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Navigation: - m_Mode: 3 - m_WrapAround: 0 - m_SelectOnUp: {fileID: 0} - m_SelectOnDown: {fileID: 0} - m_SelectOnLeft: {fileID: 0} - m_SelectOnRight: {fileID: 0} - m_Transition: 1 - m_Colors: - m_NormalColor: {r: 1, g: 1, b: 1, a: 0} - m_HighlightedColor: {r: 0.7960785, g: 0.8352942, b: 0.87843144, a: 1} - m_PressedColor: {r: 0.6226415, g: 0.61383057, b: 0.61383057, a: 1} - m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} - m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} - m_ColorMultiplier: 1 - m_FadeDuration: 0.1 - m_SpriteState: - m_HighlightedSprite: {fileID: 0} - m_PressedSprite: {fileID: 0} - m_SelectedSprite: {fileID: 0} - m_DisabledSprite: {fileID: 0} - m_AnimationTriggers: - m_NormalTrigger: Normal - m_HighlightedTrigger: Highlighted - m_PressedTrigger: Pressed - m_SelectedTrigger: Selected - m_DisabledTrigger: Disabled - m_Interactable: 1 - m_TargetGraphic: {fileID: 7393833532225704344} - m_OnClick: - m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 7393833531132547638} - m_TargetAssemblyTypeName: PhotoCaptureElement, ReadyPlayerMe.Core.AvatarCreator - m_MethodName: TakePhoto - m_Mode: 1 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 ---- !u!1 &7393833532304224494 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 7393833532304224495} - - component: {fileID: 7393833532304224493} - - component: {fileID: 7393833532304224492} - m_Layer: 5 - m_Name: Border - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &7393833532304224495 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7393833532304224494} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 7393833532473299346} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} - m_Pivot: {x: 0.5, y: 0.5} ---- !u!222 &7393833532304224493 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7393833532304224494} - m_CullTransparentMesh: 1 ---- !u!114 &7393833532304224492 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7393833532304224494} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Material: {fileID: 0} - m_Color: {r: 1, g: 1, b: 1, a: 1} - m_RaycastTarget: 1 - m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} - m_Maskable: 1 - m_OnCullStateChanged: - m_PersistentCalls: - m_Calls: [] - m_Sprite: {fileID: 21300000, guid: f3be935944ee4754d8d71cdf47dea555, type: 3} - m_Type: 1 - m_PreserveAspect: 0 - m_FillCenter: 0 - m_FillMethod: 4 - m_FillAmount: 1 - m_FillClockwise: 1 - m_FillOrigin: 0 - m_UseSpriteMesh: 0 - m_PixelsPerUnitMultiplier: 10 ---- !u!1 &7393833532473299357 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 7393833532473299346} - - component: {fileID: 7393833532473299344} - - component: {fileID: 7393833532473299347} - m_Layer: 5 - m_Name: CameraTextureTarget - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &7393833532473299346 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7393833532473299357} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: - - {fileID: 7393833532304224495} - m_Father: {fileID: 7393833532474683808} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} - m_Pivot: {x: 0.5, y: 0.5} ---- !u!222 &7393833532473299344 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7393833532473299357} - m_CullTransparentMesh: 1 ---- !u!114 &7393833532473299347 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7393833532473299357} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Material: {fileID: 0} - m_Color: {r: 1, g: 1, b: 1, a: 1} - m_RaycastTarget: 1 - m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} - m_Maskable: 1 - m_OnCullStateChanged: - m_PersistentCalls: - m_Calls: [] - m_Texture: {fileID: 0} - m_UVRect: - serializedVersion: 2 - x: 0 - y: 0 - width: 1 - height: 1 ---- !u!1 &7393833532474683811 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 7393833532474683808} - - component: {fileID: 7393833532474683809} - m_Layer: 5 - m_Name: CameraView - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &7393833532474683808 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7393833532474683811} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: - - {fileID: 7393833532473299346} - m_Father: {fileID: 7393833530818401166} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0.5, y: 1} - m_AnchorMax: {x: 0.5, y: 1} - m_AnchoredPosition: {x: 0, y: -120} - m_SizeDelta: {x: 800, y: 400} - m_Pivot: {x: 0.5, y: 1} ---- !u!114 &7393833532474683809 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7393833532474683811} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 3312d7739989d2b4e91e6319e9a96d76, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Padding: {x: 0, y: 0, z: 0, w: 0} - m_Softness: {x: 0, y: 0} diff --git a/Samples~/AvatarCreatorSamples/Prefabs/Elements/PhotoCaptureElement.prefab.meta b/Samples~/AvatarCreatorSamples/Prefabs/Elements/PhotoCaptureElement.prefab.meta deleted file mode 100644 index a5a97e19..00000000 --- a/Samples~/AvatarCreatorSamples/Prefabs/Elements/PhotoCaptureElement.prefab.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 24f994c30001bdf4895fcc448863fd61 -PrefabImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Samples~/AvatarCreatorSamples/Scripts/UI/SelectionScreens/AvatarCreatorSelection.cs b/Samples~/AvatarCreatorSamples/Scripts/UI/SelectionScreens/AvatarCreatorSelection.cs index 0392025b..17d694b7 100644 --- a/Samples~/AvatarCreatorSamples/Scripts/UI/SelectionScreens/AvatarCreatorSelection.cs +++ b/Samples~/AvatarCreatorSamples/Scripts/UI/SelectionScreens/AvatarCreatorSelection.cs @@ -64,7 +64,6 @@ private async void Setup() ctxSource = new CancellationTokenSource(); avatarManager = new AvatarManager( - AvatarCreatorData.AvatarProperties.BodyType, inCreatorConfig, ctxSource.Token); avatarManager.OnError += OnErrorCallback; @@ -161,15 +160,15 @@ private async Task LoadAvatar() } else { + var id = AvatarCreatorData.AvatarProperties.Id; + var bodyType = AvatarCreatorData.AvatarProperties.BodyType; if (!AvatarCreatorData.IsExistingAvatar) { - (avatar, AvatarCreatorData.AvatarProperties) = await avatarManager.CreateAvatarFromTemplate( - AvatarCreatorData.AvatarProperties.Id - ); + (avatar, AvatarCreatorData.AvatarProperties) = await avatarManager.CreateAvatarFromTemplate(id, bodyType); } else { - avatar = await avatarManager.GetAvatar(AvatarCreatorData.AvatarProperties.Id); + avatar = await avatarManager.GetAvatar(id, bodyType); } } @@ -282,7 +281,7 @@ private async void UpdateAvatar(object assetId, Category category) payload.Assets.Add(category, assetId); lastRotation = currentAvatar.transform.rotation; LoadingManager.EnableLoading(UPDATING_YOUR_AVATAR_LOADING_TEXT, LoadingManager.LoadingType.Popup); - var avatar = await avatarManager.UpdateAsset(category, assetId); + var avatar = await avatarManager.UpdateAsset(category, AvatarCreatorData.AvatarProperties.BodyType, assetId); if (avatar == null) { return;