Question

I'm using Unity 3.5, trying to make a standalone OSX player for my application. Everything goes quite swimmingly until I make a pkg from it using productbuild.

The syntax for my productbuild line is as follows:

productbuild --component ProjectName.app "/Applications" --sign "$signingid" ProjectName.pkg

Although this initially seems to work, and produces a pkg file that seems to install the application correctly after asking for permission from a superuser to do so, when I run the installed application, however, I discovered that it was not keeping my save data. Application.datapath evidently, is set to "/Applications/ProjectName.app/Contents/" in this case, and is not world-writable.

As far as I can see, I have two possible solutions: The first is to find some way to make sure that Application.datapath is writable when my application begins. I do not know how I might go about this, however. The only other solution I can see is to make all the necessary changes to my application such that it no longer assumes that Application.datapath is writable, and I will need to establish another location to save my persistent data. If I take this latter approach, I will need also need to know if Unity provides a facility for getting a directory that I can store such data at, because I do not currently know of one.

If there are other approaches beyond the two I've outlined above, I'm definitely open to alternatives, but if anyone can help me wade through what I need to know to accomplish either of the above, I would be equally appreciative on that front as well.

Thanks in advance for any assistance anyone can offer.

Was it helpful?

Solution

Application.datapath is where the app is stored and owned by root. To get the directory for storing persistent data between runs you need Application.persistentDataPath which is by default somewhere under ~/Library/. I haven't used the OSX stand-alone player but at least for editor player and iOS it works that way.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top