胡佳骏 1 жил өмнө
parent
commit
90df63456e

+ 13 - 2
Samples~/SDK/XRRGBCamera.cs

@@ -18,18 +18,29 @@ public class XRRGBCamera : SingletonMono<XRRGBCamera>
 
     public void playCamera()
     {
+        if (RGBCamTexture != null)
+        {
+            RGBCamTexture.Stop();
+        }
         CaptureImage = RGBCamTexture.GetTexture();
         if (this.GetComponent<RawImage>() != null)
         {
             this.GetComponent<RawImage>().texture = CaptureImage;
             this.GetComponent<RawImage>().transform.localEulerAngles = new Vector3(-180, 0, 0);
         }
+        if (this.GetComponent<MeshRenderer>() != null)
+        {
+            this.GetComponent<MeshRenderer>().material.mainTexture = CaptureImage;
+            this.GetComponent<MeshRenderer>().transform.localEulerAngles = new Vector3(-180, 0, 0);
+        }
         RGBCamTexture.Play();
     }
 
     public void stopCamera()
     {
-
-        RGBCamTexture.Stop();
+        if (RGBCamTexture != null)
+        {
+            RGBCamTexture.Stop();
+        }
     }
 }