Объявление
public void Stop();Описание
Остановка камеры.
Вызовите Application.RequestUserAuthorization перед созданием Текстура веб-камеры.
// Запускает камеру и присваивает текстуру текущему рендереру.
// Останавливает камеру при нажатии и отпускании кнопки «Стоп».
using UnityEngine;
using System.Collections;
public class ExampleClass : MonoBehaviour
{
public WebCamTexture webcamTexture;
void Start()
{
webcamTexture = new WebCamTexture();
webcamTexture.Play();
Renderer renderer = GetComponent<Renderer>();
if (webcamTexture.isPlaying)
renderer.material.mainTexture = webcamTexture;
}
void OnGUI()
{
if (webcamTexture.isPlaying)
if (GUILayout.Button("Stop"))
webcamTexture.Stop();
}
}