0

Is there a way to open Unity application through a link from a PDF or something? Like, when the user clicks on the link, the Unity app opens and then shows the image to which the user has clicked the link for. Similarly, 3 different links are kept and each link opens the same Unity application but shows different images.

I am looking to program this in .exe and .apk. Which is why I wanted to know if it is possible?

1 Answers1

1

Allow me to mention a more general case first.

As you likely know, if you have an .exe which you want to run with additional data, this can be done using command-line arguments: in your case, one that determines which fixed "image" you want to show. User Taylor-Libonati on the Unity Answers forum has provided a snippet as a suggestion for reading command-line args in Unity.

However, you wish to run the application through a link. The cleanest way to do this would be to use a custom URL scheme -- define a custom protocol that launches your app upon a click. For Android, an example can be found on the Unity Answers forum by the user Cake.

For Windows, you'll have to tamper with the Registry as shown in James Gregory's answer to a similar question. (Or look into "pluggable protocol handlers", but I have no idea what those are.)

In both cases, you'll need to intercept the data from the link. This tutorial (which isn't quite what you're looking for but should be a good guideline) suggests that in a Windows environment, the link might be passed as the first command-line argument, which we know we can read. I'd suggest experimentation.

Alas, I'm afraid I don't know how you'd intercept this for Android. I've never deployed anything made with Unity to that platform.

Hopefully you'll be able to implement something based on these considerations though.

Lumos
  • 358
  • 3
  • 10
  • Thank you. I used Command Line Arguments to pass arguments to Unity application. –  Oct 25 '19 at 08:43