Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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
0
Question by bitbot · Jun 06, 2012 at 11:02 PM · tilemaplevellevel design

Creating part of the 2d level with a text file, part in editor?

I have a 2d game with tiles, which can load the tiles from a text file. The thing is I want to load the text file into the editor so I can play around with it, and add more things to the scene, based on the location of the tiles.

I am only using the text file as a faster way to place tiles (as I find with 2d, it takes a while to do)

Is there any way to get the editor to run a script to load objects off the text file?

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Julien-Lynge · Jun 06, 2012 at 11:25 PM

The way you can access text files (both in the editor and in compiled games) is through a Resources folder - place your text file in a folder called 'Resources' under the Assets directory and Unity will load it.

http://unity3d.com/support/documentation/ScriptReference/Resources.Load.html

Then, if you know how to program, you can create an editor script that will place the tiles in the scene.

http://unity3d.com/support/documentation/Components/gui-ExtendingEditor

For instance, if you want the tiles to be placed when selecting a menu item:

http://unity3d.com/support/documentation/ScriptReference/MenuItem.html

If you have your tiles as prefabs, be sure to check out http://unity3d.com/support/documentation/ScriptReference/PrefabUtility.html for how to instantiate the prefabs in-scene.

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 Julien-Lynge · Jun 06, 2012 at 11:27 PM 0
Share

BTW: The text file will become a TextAsset when Unity imports it. Here's how you work with TextAssets:

http://unity3d.com/support/documentation/Components/class-TextAsset.html

http://unity3d.com/support/documentation/ScriptReference/TextAsset

avatar image bitbot · Jun 08, 2012 at 04:59 PM 0
Share

thank you for that well answered...answer! I have the tiles as prefabs, and the text file will let me know the location the tiles need to go. I will extend the editor to read and print the locations, then I will create scenes with foreground/background and save them in relation to each text file. Thanks! (i wanted to upvote, but it said i don't have permission)

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

World building advice for 3.5D platformer 0 Answers

Texturing rooms all the same? 1 Answer

Ways to texture very large mesh 0 Answers

How would you go about designing and implementing an indoor level? 2 Answers

Life Player loads another level 1 Answer


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