- Home /
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?
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.
any suggestions on switching that info to X$$anonymous$$L and reading it? I've never used it before