Запрос авторизации для использования веб камеры или микрофона в Web Player'е.
For security reasons (to avoid implementing a web player spying on users), we require you to have the user explicitly allow these features in the web player. To do so, you need to call Application.RequestUserAuthorization, which shows a dialog box to the user, and wait for operation to complete before being able to use these features. Используйте Application.HasUserAuthorization для запроса результата операции.
function Start() { // Request permission to use both webcam and microphone. yield Application.RequestUserAuthorization (UserAuthorization.WebCam | UserAuthorization.Microphone);
if (Application.HasUserAuthorization(UserAuthorization.WebCam | UserAuthorization.Microphone)) { // we got permission. Set up webcam and microphone here. } else { // no permission. Show error here. } }
using UnityEngine; using System.Collections;
public class ExampleClass : MonoBehaviour { IEnumerator Start() { yield return Application.RequestUserAuthorization(UserAuthorization.WebCam | UserAuthorization.Microphone); if (Application.HasUserAuthorization(UserAuthorization.WebCam | UserAuthorization.Microphone)) { } else { } } }