コード例 #1
0
 private CaptureBehaviourBase GetCaptureBehaviourByMode(CamMode mode)
 {
     if (mode == CamMode.PhotoMode)
     {
         NRCaptureBehaviour capture = GameObject.FindObjectOfType <NRCaptureBehaviour>();
         var headParent             = NRSessionManager.Instance.NRSessionBehaviour.transform.parent;
         if (capture == null)
         {
             capture = GameObject.Instantiate(Resources.Load <NRCaptureBehaviour>("Record/Prefabs/NRCaptureBehaviour"), headParent);
         }
         GameObject.DontDestroyOnLoad(capture.gameObject);
         return(capture);
     }
     else if (mode == CamMode.VideoMode)
     {
         NRRecordBehaviour capture = GameObject.FindObjectOfType <NRRecordBehaviour>();
         var headParent            = NRSessionManager.Instance.NRSessionBehaviour.transform.parent;
         if (capture == null)
         {
             capture = GameObject.Instantiate(Resources.Load <NRRecordBehaviour>("Record/Prefabs/NRRecorderBehaviour"), headParent);
         }
         GameObject.DontDestroyOnLoad(capture.gameObject);
         return(capture);
     }
     else
     {
         throw new Exception("CamMode need to be set correctly for capture behaviour!");
     }
 }
コード例 #2
0
        public static void CreateAsync(bool showHolograms, OnVideoCaptureResourceCreatedCallback onCreatedCallback)
        {
            NRVideoCapture capture = new NRVideoCapture();

            capture.m_RecordBehaviour = NRRecordBehaviour.Create(() =>
            {
                if (onCreatedCallback != null)
                {
                    onCreatedCallback(capture);
                }
            });
        }