using UnityEngine;
using System.Collections;
public class SelfieScreen : MonoBehaviour {
private CanvasRenderer m_renderer;
private WebCamTexture m_selfie;
private WebCamDevice [] m_webCamDevices;
private Quaternion m_baseRotation;
private Material m_material;
void Start() {
m_baseRotation = transform.rotation;
m_renderer = GetComponent<CanvasRenderer>();
m_material = m_renderer.GetMaterial();
m_webCamDevices = WebCamTexture.devices;
m_selfie = new WebCamTexture(m_webCamDevices[m_webCamDevices.Length - 1].name, Screen.width, Screen.height);
m_renderer.SetMaterial(m_renderer.GetMaterial(), m_selfie);
Logger.Log(m_selfie.videoRotationAngle);
Logger.Log(m_selfie.videoVerticallyMirrored);
m_selfie.Play();
}
void Update() {
m_renderer.SetMaterial(m_renderer.GetMaterial(), m_selfie);
}
}
This code works well when i build it on unity editor. But when i build this to iphone it crashes on launch. If I comment out the line that tries to print the videoRotationAngle then then build works on iphone. Anyone has experienced this?