using NRKernal; using SC.XR.Unity; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class XRRGBCamera : SingletonMono { public Texture CaptureImage; NRRGBCamTexture RGBCamTexture; public bool isAuto = true; private void Start() { RGBCamTexture = new NRRGBCamTexture(); if (isAuto) playCamera(1280, 720); } public void playCamera(int w, int h) { if (RGBCamTexture != null) { RGBCamTexture.Stop(); } CaptureImage = RGBCamTexture.GetTexture(); if (this.GetComponent() != null) { this.GetComponent().texture = CaptureImage; this.GetComponent().transform.localEulerAngles = new Vector3(-180, 0, 0); } if (this.GetComponent() != null) { this.GetComponent().material.mainTexture = CaptureImage; this.GetComponent().transform.localEulerAngles = new Vector3(-180, 0, 0); } RGBCamTexture.Play(); } public void stopCamera() { if (RGBCamTexture != null) { RGBCamTexture.Stop(); } } }