I’m trying to make it so players can launch our Unity game from a URL, and to capture the parameters passed.
I’ve gotten as far as registering a URL-scheme handler by editing the info.plist, and that works - the app can launch via a URL in a browser. However, I’m having trouble retrieving the parameters.
I was hoping these would translate to command-line arguments( which Unity can read) - but it doesn’t.
It seems that the way to do this on Mac is to register a hook in native code for when the application finishes launching - for instance like this:
However, my attempt to do this through a native mac plugins doesn’t seem to work - presumably because the event triggered happens before my plugin is loaded.
Does anyone know how to do this?
One potential solution I’ve been considering is to use a separate application to receive the URL, which would then launch my game.
Barring a more elegant solution, could anyone suggest a clean way to do that? Perhaps I could put two executables in the same package and have one trigger the other?