Is there a way to pass values from a browser to Unity? I attempted to use clipboard.js and the clipboard but it doesn't seem to work on the hololens, is there another way to pass values to Unity from the browser?
Have your tried using google sheets? I have seen people using that in their projects to write and read data from a google sheet inside of an app
I don't think google sheets will work for what I want to do, but I guess I need to explain my needs further. I have a custom web application that you need to log in to, and it uses Azure Multi-Factored authentication, once you log in you get a security token. I need a way to pass the token from the browser to Unity. My first attempt was trying to just put the token in the clipboard then access it in unity, while this works on other platforms, it does not work on hololens. So I'm wondering if there's another way to pass the value to unity (possibly a custom URI handler)?
Found some documentation on URI handling for WSA in this dark corner of Unity documentation: https://docs.unity3d.com/560/Documentation/Manual/windowsstore-assocation-launching.html Using this I can now launch my program with foo://bar but I can't seem to figure out how to access the bar part after the :// the example project has it as part of UnityEngine.WSA.Application.arguments but when I run the app on hololens UnityEngine.WSA.Application.arguments is always empty
Replying to my own reply, as this has been solved, and so this will show up if anyone finds this page in a search: In order to access the arguments after the ://, you have to grab the Uri in the ApplicationView_Activated function in App.cs, and then pass it to Unity using InvokeOnAppThread like so: Code (csharp): private void ApplicationView_Activated(CoreApplicationView sender, IActivatedEventArgs args) { if (args.Kind == ActivationKind.Protocol) { var arg = args as ProtocolActivatedEventArgs; m_AppCallbacks.InvokeOnAppThread( () => { UnityClass.DoThingBasedOnUri(arg.Uri.AbsoluteUri); //Replace this with the unity class you want receiving the data }, false); } CoreWindow.GetForCurrentThread().Activate(); }
Glad to see you found a solution for the problem, thank you for posting the answer. I learned a lot from this post