Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Using an in-game editor to create built-in levels

Discussion in 'Scripting' started by Timbecile76, Jan 20, 2011.

  1. Timbecile76

    Timbecile76

    Joined:
    Jul 8, 2009
    Posts:
    248
    So I'm working on a easy little puzzle game, and I've made an editor for myself to create all of the levels that I'm going to be releasing the game with.

    Initially I'd planned to just save the level data with PlayerPrefs, but I don't know how to get the level data from my editor on the iPhone (which is basically a different scene of the same game) back into Unity. The data is all strings and ints and vector3s.

    I'm trying to streamline the process so I don't have to go and hand type in this data into a game script. I play on shipping with a whole load of levels, so that would be way too time consuming.

    How should I go about approaching this? Any suggestions?
     
  2. Timbecile76

    Timbecile76

    Joined:
    Jul 8, 2009
    Posts:
    248
    *Bump*

    Anyone?
     
  3. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Probably TextAssets would be easiest.

    --Eric
     
  4. Timbecile76

    Timbecile76

    Joined:
    Jul 8, 2009
    Posts:
    248
    ok, if I understand TextAssets right, I can use my editor to write a text file that the game will later import as a text file, right?

    How would I get the text file that the game created from my iPhone editor back into the game project?
     
  5. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    No, see the TextAsset code examples in the docs. It's an asset like other assets.

    --Eric