• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by aaronflippo · May 10, 2013 at 10:28 PM · macosxurlcommand line

Parse URL passed parameters on Standalone Mac build

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:

http://stackoverflow.com/questions/6561661/url-scheme-qt-and-mac

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?

Comment
Add comment · Show 3
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image trieb-raum · Feb 20, 2016 at 10:22 PM 0
Share

Have you found a nice solution to this issue? Is there a proper way now to achieve launching by url-scheme in Unity 5 now?

avatar image ThiagoSCF · Mar 29, 2017 at 03:56 PM 0
Share

Same here. Did anyone figure this out?

avatar image fcloss · Jun 30, 2017 at 03:48 PM 0
Share

HI guys, any solution found? I would need custom url and file association!

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by aaronflippo · Jun 30, 2017 at 03:59 PM

I never found a good easy solution. Basically, we made it so when you clicked a button on the webpage, it recorded some info on a server, and triggered the game to launch. Then the game looked for the existence of that chunk of data that was associated with the user's account. It wasn't very elegant.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image fcloss · Jun 30, 2017 at 04:21 PM 0
Share

That's sad that Unity hasn't made Delegates available. I saw a hacking for overriding them, but a commercial app should not be a bunch of hacking. If unity dev just made association and custom url accessible, it would solve 99% of the devs requests.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

16 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Unity 3.5b6 building for OSX 10.5 0 Answers

How to install Unity 4 on OSX after installing 5 2 Answers

Unity UI Tearing on resolution change on OSX 0 Answers

Why is my application pausing when starting on Mac through Steam? 2 Answers

Kinect doesn't work on the virtual machine or Mac. 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges