I need to access the PicturesLibrary fodler on the Hololens.
Docs state that you can do that by "Windows.Storage.PicturesLibrary"
But I can not import the namespace "Windows" in my Unity project because its not included in UWP, also it should be possible.
I am using the Unity3D 2019.2 with .net 4.x
How can I load pictures from the folder the right way with the HoloLens?
I tried some examples from similar questions but none of them worked, like eg.g:
#if !UNITY_EDITOR && UNITY_WINRT_10_0
return Windows.Storage.KnownFolders.PicturesLibrary.Path;
#else
#crani have you set the UWP App Capability declaration for PicturesLibrary access?
note that the docs mention that the capability provides access to "enumerate" the files in the library. Path is typically going to be an empty string for any of the KnowFolder types.
You will need to do something like this:
StorageFolder picturesFolder = KnownFolders.PicturesLibrary;
IReadOnlyList<StorageFile> pictures = await picturesFolder.GetFilesAsync();
So if you wrap something similar in an #if directive you should be able to access the files, but the path is abstracted from the app as a storage folder.
Related
I'm trying to learn to write Hardware Abstraction Layer (HAL).
Here's the path I've taken so far, please correct me if I'm off in any step.
Downloaded AOSP and built it successfully (86%)
Located Vehicle Hal Support Library
Located android.hardware.automotive.vehicle C++ code.
Things I've attempted after that the steps below without succeeding to get those above classes recognized.
Import android.hardware.automotive.vehicle classes in Android Studio for a typical Android App that targets 29 Api Level.
Adding meta tag of android.car app
Copy/Pasting all source code under AOSP /packages/services/Car/
Partially contemplated adding android.hardware.automotive.vehicle#2.0.so Library and trying to access it through JNI (Not so sure about this one).
Please orient me, I see some repositories on github not doing anything special and somehow they're able to import the package in a java class like this.
import android.hardware.automotive.vehicle.V2_0.VehicleHwKeyInputAction;
import android.hardware.automotive.vehicle.V2_0.VehiclePropValue;
import android.hardware.automotive.vehicle.V2_0.VehicleProperty;
import android.hardware.automotive.vehicle.V2_0.VehiclePropertyAccess;
Here
how on earth do they get access to those classes?
Thanks
Vehicle HAL is not meant to be accessed directly from apps. Car Service does that for you.
You have couple options depending on what you're actually trying to accomplish:
Learn to write HAL services - it's like writing a driver for a given hardware (in this case, something that provides car data to Car Service).
Learn to write HAL clients - try modifying EmbeddedKitchenSink app first. Please note you need to build it with AOSP and not in AmdroidStudio since this is a system app (and regular apps doesn't have access to the HAL)
Learn Vehicle APIs - that's what you need car lib for. Details on how to use it: https://stackoverflow.com/a/63321234/14759774
My company is using RPG Maker MV (based on JavaScript) and looking to port over to Xbox UWP. It's no longer supported in the latest version of Visual Studio.
Is there a workaround or should I abandon this and convert over to C#?
Sadly this has indeed been deprecated, but as a workaround you can use a WebView to host the game which is what I do with mine. You'll still have to deal with a few extra things if you want to use the Xbox storage functions (see here for my commentary on this) and you still need to implement sign-in (which I'm still working on) but once you add the WebView to your MainPage.xaml name it something like ContentViewport and (immediately following your login and file processing logic) add the following line of code:
ContentViewport.Source = new Uri("ms-appx-web:///index.html");
Or wherever your index.html is, so if you prefer assets over package root with the www folder copied in as a base, you can use the following:
ContentViewport.Source = new Uri("ms-appx-web:///assets/www/index.html");
I am trying to get access to the bounding box/Chaperone of my VR project without relying on SteamVR. I am trying to build a framework that works as native as possible to Unity.
In SteamVR one would write:
Valve.VR.OpenVR.Chaperone.ForceBoundsVisible(true);
// or
Valve.VR.OpenVR.Chaperone.ForceBoundsVisible(False);
My question is how can I do something similar to this with just the OpenVR package and not the SteamVR plugin.
thanks
You can use OpenVR SDK.
If you are using C#, there is a wrapper lacated at headers\openvr_api.cs.
At first you have to load library (openvr_api.dll) and init it like this:
var error = EVRInitError.None;
OpenVR.Init(ref error, EVRApplicationType.VRApplication_Background)
Then simply use it the same way
OpenVR.Chaperone.ForceBoundsVisible(true);
You can also read chaperone_info.vrchap and steamvr.vrsettings from config folder of Steam. These json files contain information about all universes collision bounds.
My partner in game dev are looking at Unity. I dynamically loaded an asset using Resource.Load() and he used AssetDatabase.LoadAssetAtPath(). They both seem to work so which one should be used? Why have 2 different ways to dynamically load assets?
AssetDatabase.LoadAssetAtPath() vs Resource.Load() ...They both
seem to work so which one should be used?
None of them.
Your partner will end up with a game that he cannot build because he used AssetDatabase.LoadAssetAtPath(). The AssetDatabase.LoadAssetAtPath() function came from the UnityEditor namespace which is only used to make Editor plugins. It won't work outside the Editor and it won't even let you build your game at-all.
You using Resource.Load is fine but Resource.Load requires the use of the Resources folder which is known to cause slow down loading time of the game.
AssetBundles is the recommended way. You can put those files in the StreamingAssets folder then use the WWW or AssetBundle API to load it during run-time. You can learn more about how to use AssetBundles here
Hi I am making a game on unity with airconsole and when I try to import the airconsole controls github repo to my unity project I get a lot of javascript errors, so I can't use the controller generator and it hinders me, A LOT.
Thanks in advance, you would save my skin.
Your HTML, CSS and JavaScript files, as well as all additional resources your controller will need (images etc.), need to be in Assets/WebGLTemplates/AirConsole so Unity will not try to compile them into C# or UnityScript.
Your controller HTML file itself can be somewhere else in the project, the file within Assets/WebGLTemplates/AirConsole will be updated automatically to match it as long as it is linked in the AirConsole Object in your scene.
If you add the plugin including example scenes into an empty project, you will see a working folder structure.
Edit/Update: in case you are getting errors along the lines of The type or namespace name 'ILGenerator' could not be found (or the same but with DynamicMethod) please see details on Reddit or StackOverflow.
Essentially: you have to set API Compatibility level o 4.x in your Player Settings for your selected platform.