- Home /
Question by
Enrico-Monese · May 09, 2013 at 06:49 PM ·
readload leveltext file
Read text file content to determine which level to load
hi there i have a script that creates a text file with a number written in it, like a 1 or a 2, what i need is a script that reads the file and if there is a 1 the game should load the level 1 scene, if there is a 2 then load level 2, a 3 to load level 3...
how can i do this?
Comment
Best Answer
Answer by whydoidoit · May 09, 2013 at 06:50 PM
Application.LoadLevel(int.Parse(stringFromFile));
You can get an array of the strings using:
var lines = System.IO.File.ReadAllText(somePath).Split('\n');
Your answer
Follow this Question
Related Questions
How to Read & Write Integers to Text File 0 Answers
Unity iPhone - Using the file system in my app/game? 1 Answer
Saving My World 1 Answer
System.IO documentation? 2 Answers
Script not reading other script 2 Answers