Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 Jun 22
sparklines
Close Help
  • 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
0
Question by Somian · Oct 12, 2014 at 03:01 PM · macxmlfiles

assign file type to a game?

Hi,

i want to make a mac game with a simple level editor that allows people to write a custom XML file type with my own extension they can share.

Is there a way to register my unity game to open this file type in OS X (and to do this abstract for the user, so when they got the game from the app store, the icons for the level XMLs should change to my defined icon). SO when people double-click the XML someone sent them via e-mail, it should simply open the game and load the level from the file.

Comment
Add comment · Show 2
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 inwoods · Oct 30, 2014 at 07:16 PM 0
Share

Does anyone have an answer for OSX?

Double clicking on a file on OSX does not put the filename on the command-line arguments, as it does on windows. $$anonymous$$odifying the Info.plist is only part of the answer. You also need to provide a custom implementation for NSApplicationDelegate openFile.

How do you hook that into a unity project?

avatar image adieu2 inwoods · Dec 04, 2020 at 02:16 PM 0
Share

Sorry, I know this is an old post, but did you manage to get it work? I have exactly the same problem and this issue seems to still be, six years later, poorly documented.

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Landern · Oct 12, 2014 at 03:20 PM

Update your applications info.plist and associate with your xml file type.

You can get the command line arguments with System.Environment.GetCommandLineArgs, i assume osx/windows standalone will pass in the full path of the argument(the file).

You may want the first scene to have an awake method/function that checks for the arguments if it has arguments, take action, otherwise load other scene(default).

Comment
Add comment · Show 4 · 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 KpjComp · Oct 12, 2014 at 03:26 PM 0
Share

Would that not associate all xml's with his program, if so that seems to me to be a bad idea, as the user might have the X$$anonymous$$L file already associated with some of editor etc. I know I would be angry if a game I played broke my X$$anonymous$$L editor link.

Wound't creating a different extension, like *.SomianGameLevel, and then associate that with his game? An X$$anonymous$$L file doesn't have to have an X$$anonymous$$L extension.

avatar image Somian · Oct 12, 2014 at 03:29 PM 0
Share

Like I stated above, i'll use my own extension and just name it .awesomeGameLevel or something :)

thanks.

That's the first part. the second is: how does my game know it's supposed to load the level right away when it launches? And how does it get the path to the level the user opened?

avatar image Landern · Oct 12, 2014 at 03:39 PM 0
Share

@$$anonymous$$pjComp the specificity was already in @Somian's original question ("custom X$$anonymous$$L file type with my own extension they can share"), so others won't get all jumpy, i've updated my answer.

An X$$anonymous$$L file doesn't have to have an X$$anonymous$$L extension.

Never said it did.

avatar image KpjComp · Oct 12, 2014 at 06:39 PM 0
Share

Yeah don't worry, it was they way I interpreted this bit -> "and associate with your xml file type." For some reason the word type didn't register.

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.

Follow this Question

Answers Answers and Comments

31 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 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

Build problem: I only need a picture of some files or some instructions PLEASE HELP 1 Answer

In-app purchase "Invalid product" on Mac Store build 0 Answers

Switching Project files between Mac and PC. 2 Answers

Loading multiple files using js, importing a set of xml files 1 Answer

XML File not reading in Mac OSX build 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges