Requesting Permissions
Always Ask Nicely
Before accessing a camera or microphone, your app must first request permissions to do so from the user. If the user does not grant the necessary permissions, you will not be able to use the corresponding media device.
Checking Permissions
The MediaDeviceQuery
class provides the CheckPermissions
function to check the current permission status for a given media device type:
Requesting Permissions
The MediaDeviceQuery
class provides the RequestPermissions
method to request permissions for a given media device type:
The request is an asynchronous operation. The native OS permissions dialog will be presented to the user, and the returned Task<bool>
will complete once the user has responded to the dialog:
On iOS, you must enter a Camera Usage Description in Unity's Player Settings for the camera permission dialog to be shown.
On iOS, you must enter a Microphone Usage Description in Unity's Player Settings for the microphone permission dialog to be shown.
If the user has rejected the permission, calling RequestPermissions
will not cause the permission dialog to be displayed again.
Last updated