Hi all,
I purchased a copy of Unity Indie yesterday for my company’s (a.k.a myself and one other guy foray into the casual game market, and I already have a couple of questions regarding .unityweb packages. I know similar questions have been asked by others in these forums throughout the past couple of years, but they all seem to be missing straight and/or complete answers, which I’m really hoping isn’t a sign that there are no straight answers.
Our first project with Unity is a 2D puzzle-platformer of sorts, so understandably we want to be able to store our level data (tile layers, sprite placements, etc.) in an arbitrary file format of our choosing, as Unity’s built-in formats don’t quite fit the bill. Now for standalone distributions we could simply use the .NET Framework’s file IO routines to load in whatever data was needed, but since this project is intended to be web-only we need a method of a) including arbitrary files in the .unityweb package and b) extracting and parsing those files at runtime via Unity’s scripting system.
Satisfying the first requirement doesn’t appear to be that difficult, as Unity does provide the special “Resources” folder for forcing arbitrary assets to be included in a distribution. I’ve noticed that if I stick unrecognized file types (such as XML files) into the “Resources” folder they show up in the Unity IDE as “Default Assets”, which I’m hoping means that they’ll be inserted into whatever distribtions I create, including .unityweb ones.
Satisfying the second requirement is proving to be a little trickier, as I’ve been unable to locate anything in the documentation that covers the loading of “unrecognized” asset types. The Resources.Load() function returns a value of type GameObject, so I’m guessing that it will fail if the path it’s given doesn’t reference a known type. The System.IO routines won’t work in a web browser’s sandbox, and even if there was some way to gain binary read access to the .unityweb package I wouldn’t know how to parse it.
As a temporary workaround I’m building a little export utility that spits out level data in the form of a c# script with one doozy of an array declaration, but for this and future projects it would be really nice if there was a straighforward method of including and then referencing non-Unity-supported asset types. With a bit of luck there’s already a method of doing so (undocumented though it may be) and one of you Unity gurus can earn extra karma points by enlighting me. And if it turns out be impossible under 1.6.2, I’ll stick with my “data as a script” workaround for now and hope that the issue will be properly addressed in the upcoming 2.0 release.