Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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
1
Question by Easy · Jul 18, 2010 at 05:02 PM · iphoneleveldatageneratorstructure

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.

Comment
Add comment · Show 1
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 spinaljack · Jul 18, 2010 at 06:06 PM 0
Share

Just export the scene in a unity package when he's done.

3 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by pyro · Jul 18, 2010 at 09:42 PM

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.

Comment
Add comment · 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
0

Answer by qJake · Jul 18, 2010 at 06:14 PM

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.

Comment
Add comment · 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
0

Answer by Eric5h5 · Jul 18, 2010 at 06:28 PM

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

Comment
Add comment · Show 2 · 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 qJake · Jul 18, 2010 at 06:37 PM 0
Share

I wasn't sure if you could read off the iPhone filesystem with that... there are a lot of grey areas regarding various .NET classes and whether or not they work on the iPhone... not to mention Unity can't release the iPhone documentation because Apple are a bunch of jackasses, which doesn't help people like me that want to help, but can't, because there's no docs. :P

avatar image Eric5h5 · Jul 18, 2010 at 07:27 PM 0
Share

@SpikeX: in the current version of Unity iPhone (1.7), you can select between .NET 1.1 and 2.0 compatibility. (ReadAllText would need 2.0 I think.) You can only access a specific area per app; for example you can't read/write another app's files.

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

No one has followed this question yet.

Related Questions

Defining parameters for a level 1 Answer

How to save data on iOS? 1 Answer

Image-based Level Generator having problems 0 Answers

3D level generator on a grid C# 1 Answer

capture the screenshot to iPhone photo gallery 2 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