Unity
28 TopicsKill App When Tile Closed
Hi MR Devs, I'm looking for a way to kill the application when the 2D Tile/Panel/Slate is closed in the MR home. I'm using Unity to create a Win32 app for HP Reverb G2. When I start the app from the 3D launcher with windowed mode, a 2D view is created, however closing the view allows the app to survive and a user would need to switch back to desktop to close the application. Is there a WMR event of some sort my application can listen for to kill the application when its WMR 2D view is closed?Capturing photos in a quick way (Unity, HoloLens 2)
My objective is to analyze the HoloLens' camera stream. I've been trying to capture what the HoloLens is seeing for image processing but the only properly documented way I've found is through the library UnityEngine.Windows.WebCam. The problem with this library is that taking a photo, no matter how small, always takes a heavy toll on the device's performance. I've looked up different ways to capture the camera stream from the HoloLens but the documentations are always lacking something. So I've tried implementing the Windows.Media library in Unity to at least take a quick photo, but it doesn't seem to work. Here is how I've implemented it: using Windows.Media.Capture.Core; using Windows.Media.Devices.Core; private MediaCapture _mediaCapture; private async void StartScanTest() { _mediaCapture = new MediaCapture(); await _mediaCapture.InitializeAsync(); StartCoroutine(ScanTestUWP()); } private IEnumerator ScanTestUWP() { while (true) { CheckPatternUWP(); yield return new WaitForSeconds(0.5f); } } private async void CheckPatternUWP() { var lowLagCapture = await mediaCapture.PrepareLowLagPhotoCaptureAsync(ImageEncodingProperties.CreateUncompressed(MediaPixelFormat.Bgra8)); var capturedPhoto = await lowLagCapture.CaptureAsync(); var softwareBitmap = capturedPhoto.Frame.SoftwareBitmap; byte[] imageBytes = new byte[4 * softwareBitmap.PixelWidth * softwareBitmap.PixelHeight]; softwareBitmap.CopyToBuffer(imageBytes.AsBuffer()); Texture2D photoTexture = new Texture2D(1,1); photoTexture.LoadImage(imageBytes); await lowLagCapture.FinishAsync(); if (photoTexture) { CheckFromTexture(photoTexture); } } This is all under the #if UNITY_UWP preprocessor directive. Is there a way to get the actual camera stream from the HoloLens? If not, how can I take pictures without stuttering?6.6KViews1like3Comments