Advertisement
Guest User

Untitled

a guest
Oct 24th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3. using System.IO;
  4. using UnityEngine.UI;
  5.  
  6.  
  7. public class FileReader : MonoBehaviour {
  8.  
  9. public Text textview;
  10. // GIDEROS ANDROID SETTINGS FILE PATH
  11. //private string file_name = "/data/data/com.wixot.wordsearch/files/settings";
  12.  
  13. // GIDEROS IOS SETTINGS FILE PATH
  14. private string file_name = Application.persistentDataPath+"/settings";
  15.  
  16. void Start () {
  17.  
  18.  
  19.  
  20. this.textview.text = this.readTextFile(file_name);
  21.  
  22. }
  23.  
  24. // Update is called once per frame
  25. void Update () {
  26.  
  27. }
  28.  
  29.  
  30.  
  31. string readTextFile(string file_path)
  32. {
  33. string all = "";
  34. try {
  35. StreamReader inp_stm = new StreamReader(file_path);
  36.  
  37.  
  38. while(!inp_stm.EndOfStream)
  39. {
  40. string inp_ln = inp_stm.ReadLine( );
  41. // Do Something with the input.
  42. all = all + inp_ln;
  43. Debug.Log (inp_ln);
  44. }
  45.  
  46. inp_stm.Close();
  47. } catch (System.Exception ex) {
  48. Debug.Log (ex);
  49. }
  50.  
  51.  
  52.  
  53. return all;
  54. }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement