胡佳骏 1 year ago
parent
commit
f268a83845
1 changed files with 4 additions and 3 deletions
  1. 4 3
      Samples~/SDK/XRRGBCamera.cs

+ 4 - 3
Samples~/SDK/XRRGBCamera.cs

@@ -1,10 +1,11 @@
 using NRKernal;
+using SC.XR.Unity;
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 using UnityEngine.UI;
 
-public class XRRGBCamera : MonoBehaviour
+public class XRRGBCamera : SingletonMono<XRRGBCamera>
 {
     public Texture CaptureImage;
     NRRGBCamTexture RGBCamTexture;
@@ -18,10 +19,10 @@ public class XRRGBCamera : MonoBehaviour
     public void playCamera()
     {
         CaptureImage = RGBCamTexture.GetTexture();
-        if(this.GetComponent<RawImage>()!=null)
+        if (this.GetComponent<RawImage>() != null)
         {
             this.GetComponent<RawImage>().texture = CaptureImage;
-            this.GetComponent<RawImage>().transform.localEulerAngles = new Vector3(-180,0,0);
+            this.GetComponent<RawImage>().transform.localEulerAngles = new Vector3(-180, 0, 0);
         }
         RGBCamTexture.Play();
     }