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!"); } }
public static void CreateAsync(bool showHolograms, OnCaptureResourceCreatedCallback onCreatedCallback) { NRPhotoCapture photocapture = new NRPhotoCapture(); photocapture.CaptureBehaviour = NRCaptureBehaviour.Create(() => { if (onCreatedCallback != null) { onCreatedCallback(photocapture); } }); }