Photo Capture Element

The PhotoCaptureElement allows users to create an avatar from a selfie. The PhotoCaptureElement starts the camera of the device. After the user confirms, the subelement PhotoConfirmationElement fires an event with a Texture2D that can be passed to the AvatarManager to create an avatar draft (instead of a template).

Supported Platforms

  • iOS, Android

  • Desktop

You can also provide your own functionality to upload an existing photo and pass the texture information to the AvatarManager to create a draft avatar. Because Unity lacks native support for a file picker, we decided not to offer this functionality in the SDK.

Usage

The PhotoCaptureElement fires the OnPhotoCaptured event after the capture button is pressed. The prefab is set up in a way so that the output of the PhotoConfirmationElement waits for the Photo to be captured.

public UnityEvent<Texture2D> OnPhotoCaptured;

The PhotoConfirmationElement fires the OnPhotoConfirmed event after the confirmation button is pressed.

public UnityEvent<Texture2D> OnPhotoConfirmed;

Customization

You can exchange all the buttons. Please be aware that the Unity events are being used in the hierarchy, and make sure you re-create the same events on your new buttons. You can also embed the element in whatever container element you'd like.

Last updated