Simplest Webcam Test in Unity

Testing with THETA V

Perfect sphere with no gaps. Mac OS X 10.12.5

using UnityEngine;
using System.Collections;

public class testScriptBasic : MonoBehaviour {

	void Start () {
		WebCamDevice[] devices = WebCamTexture.devices;
		Debug.Log("Number of web cams connected: " + devices.Length);
		Renderer rend = this.GetComponentInChildren<Renderer>();

		WebCamTexture mycam = new WebCamTexture();
		string camName = devices[0].name;
		Debug.Log("The webcam name is " + camName);
		mycam.deviceName = camName;
		rend.material.mainTexture = mycam;

		mycam.Play();
	}    	
}
1 Like