- Home /
A beginner scripter needs help with spreadsheet lookup
Hi folks,
I'm a newbie scripter still just getting to know Unity 4 and scripting languages. What I'm interested in is perhaps a bit down the line, but my plan is to eventually create a game which will generate objects labelled with words drawn from a spreadsheet, so that a simple word association game can be made. Is this functionality possible within Unity 4, and what language (and HOW!?) would I even begin to go about this?
Thanks for your help,
Simt33
Answer by Loius · Apr 11, 2013 at 10:17 AM
Spreadsheet implies unnecessary complexity. All you need is a file in a format you know. Usually you know the format already, because you wrote the file.
For example, i usually use pipes as delimiters, so I'd build a '''spreadsheet''' that looks like: apple|aardvark|volcano|alphabetical
You can magically snap all those values into an array with:
var array = textAsset.text.Split( "|"[0] );
Then loop through the array to read all your words.
You probably want TextAsset as your source file, though you can read from/write to disk with System.IO. System.IO has limitations in the webplayer and on ... pretend computers like phones and tablets.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
[Answered]Rigid body Movement C# 0 Answers
Play Animation several times 0 Answers
Problems with raycast 0 Answers