Photo Capture Element
Last updated
Last updated
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).
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.
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.
The PhotoConfirmationElement
fires the OnPhotoConfirmed
event after the confirmation button is pressed.
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.