Level builder for iphone

Hi, Im working on a 2D game for iphone and i want to build a LevelBuilder, which will let level designer to work either from PC or MAC and generate Levels.

Is there a way in unity to save/read custom data structure to/from a file? All my objects have a Name, Transform and some have also Speed which controled by level designer.

I want to let the level designer to control this parameters and when he/she done with the level design, all data will be save. from this point,i want the iphone application to be able to read the data ( in data structure format ),and make the level.

Please Help.

I had just finished creating a 2D level editor for a game I'm working on and here's how I handled saving out the level so I thought I'd share: Prefabs.

Basically the idea was that in my main game engine, when it loads a level it is passed a prefab object that contains all the necessary info for that level to load (tile positions, enemy positions, item positions) and the level is built from there.

So in the level editor scene, when the level is done being built, you would then "Export" the level by creating a script that builds a new game object and saving all the level information exactly how your game engine would interpret it, then taking that object and saving it as a prefab, all within Unity, while the editor is running. (I just manually dragged the new level object into an empty prefab, but I imagine you could automate that with an editor script)

Then I go back to the main game engine scene, and then set it up to reference this newly created prefab to whatever level it is supposed to be, and that would be it. No File I/O code and all done within Unity pretty painlessly.

Utilizing Unity packages in this instance would be dangerous, because (theoretically) anyone could slip some code in that would get run, and that's a security risk. Not to mention everyone would need to use Unity to create the levels, and there's no way to really regulate that.

The only way to do this would be to custom-design the level editor yourself (you don't even have to use Unity), and then create a custom file-format that you can somehow "send" to the iPhone (I'm not familiar with the iPhone API, so I don't know how you'd accomplish that). Then, in Unity, you would have to read the custom file format off the phone after it had been downloaded (I'm not even sure you can read files off the phone), and create the level manually based on what the file provided, basically "constructing" the level by hand, based on the data in the file.

It's a long and complex process, but there really isn't an easier way. You just need to custom-code everything yourself. And don't write this off as being easy, on the contrary, this requires quite a bit of programming knowledge.

Use something from System.IO, for example ReadAllText. Then you can parse the data as necessary.