private IEnumerator UpdatePlugin() { while (true) { yield return(new WaitForEndOfFrame()); GL.IssuePluginEvent(WebcamInterop.GetRenderCallback(), 0); } }
private void OnUpdate() { //Prevents generating analytics when the scene is started if (_webcamEnabled == null) { _webcamEnabled = WebcamInterop.IsWebcamOn(); return; } WebcamToggleAnalytics(); }
private void WebcamToggleAnalytics() { bool webcamEnabled = WebcamInterop.IsWebcamOn(); if (webcamEnabled != _webcamEnabled) { _webcamEnabled = webcamEnabled; JObject o = new JObject(); o["webcam_enabled"] = webcamEnabled; SendAsyncAnalytics("unity_webcamToggle", o); } }
private void OnDisable() { if (_enableWebcamPlugin) { StopCoroutine(UpdatePlugin()); WebcamInterop.Stop(); } MetaCoreInterop.meta_enable_rgb_stream(false); _drawRgb.Clear(); _drawComposite.Clear(); _textureRequest = false; }
private void OnEnable() { if (_enableWebcamPlugin) { // Start webcam rendering WebcamInterop.Initalize(_texturePtr, PluginFps); WebcamInterop.Run(); } MetaCoreInterop.meta_enable_rgb_stream(true); InitializeMaterial(); if (_enableWebcamPlugin) { StartCoroutine(UpdatePlugin()); } }
private bool IsWebcamBeingWatched() { return(WebcamInterop.IsWebcamOn() || _targetDisplay != WebcamMirrorModes.None || _textureRequest); }