Skip to content

Commit d049399

Browse files
feat: adds image confirmation element
1 parent face150 commit d049399

File tree

8 files changed

+1458
-739
lines changed

8 files changed

+1458
-739
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using UnityEngine;
2+
using UnityEngine.Events;
3+
using UnityEngine.UI;
4+
5+
public class ImageConfirmationElement : MonoBehaviour
6+
{
7+
[Header("Settings")]
8+
[SerializeField] private RawImage imageTextureTarget;
9+
10+
[Header("Events")]
11+
public UnityEvent<Texture2D> onImageConfirmed;
12+
13+
public void SetTexture(Texture2D texture)
14+
{
15+
imageTextureTarget.texture = texture;
16+
}
17+
18+
public void ConfirmPhoto()
19+
{
20+
var texture = new Texture2D(imageTextureTarget.texture.width, imageTextureTarget.texture.height, TextureFormat.ARGB32, false);
21+
22+
onImageConfirmed?.Invoke(texture);
23+
}
24+
}

Runtime/AvatarCreator/Elements/PhotoCaptureConfirmElement.cs

Lines changed: 0 additions & 21 deletions
This file was deleted.

Runtime/AvatarCreator/Elements/PhotoCaptureElement.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ private void SetupPhotoBoothTexture(string textureName)
6161
{
6262
var size = cameraTextureTarget.rectTransform.sizeDelta;
6363
cameraTexture = new WebCamTexture(textureName, (int) size.x, (int) size.y);
64-
cameraTextureTarget.color = Color.white;
6564
cameraTextureTarget.texture = cameraTexture;
6665
}
6766

0 commit comments

Comments
 (0)