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
0
Question by WhipJr · Dec 01, 2013 at 05:30 PM · variablesiocomma

Best way to set variables from a txt file?

I have a stats text file for my character stats it's comma delimited and each new line is a new level.

Here is a sample from the lower levels for the player: _Level,_Experience,_Attack,_Defense,_Agility,_Luck,_Intellect,_Wisdom,_MaxMagic,_MaxHealth

 0,0,0,0,0,0,0,0,0,0
 1,50,10,7,1,10,5,5,10,50
 2,83,11,8,2,10,,,11,55
 3,118,12,9,3,10,,,13,60
 4,154,13,10,4,10,,,16,65
 5,192,14,11,5,10,,,20,70
 6,232,15,12,6,10,,,25,75
 7,274,16,13,7,10,,,31,80
 8,318,17,14,8,10,,,38,85
 9,364,18,15,9,20,,,46,90
 10,483,20,17,10,20,,,56,95

I'm looking for an efficient way to assign the corresponding variables from the top when the player levels up. and to check against the player's necessary amount of experience needed to level up to the next level ("_Experience"). any ideas?

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 Mortoc · Dec 01, 2013 at 06:44 PM

You can use http://docs.unity3d.com/Documentation/ScriptReference/TextAsset.html I recommend formatting your data in JSON or XML so that it's easier to read/maintain later on.

Comment
Add comment · Show 1 · 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 WhipJr · Dec 01, 2013 at 07:10 PM 0
Share

any suggestions on switching that info to X$$anonymous$$L and reading it? I've never used it before

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

17 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to change public variable by another script 0 Answers

In-Game Console and Permanent Variable Changes 1 Answer

Is there a list of variable attributes for C#? 2 Answers

Problem storing GameObject reference in script - PUN 0 Answers

how can i write this properly 3 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