//TextReader.cs by DAKDAE
using UnityEngine;
using System;
using System.Collections;
using System.IO;
public class TextReader : MonoBehaviour
{
public string TextRead(string fileName)
{
string path;
string resultText;
StreamReader sr;
path = Application.dataPath;
if(!File.Exists(path + fileName))
{
Debug.Log("no Exist File");
return null;
}
Debug.Log("File Exist");
sr = new StreamReader(path + fileName, System.Text.Encoding.Default);
if(sr == null)
{
Debug.Log("File Load Fail");
return null;
}
Debug.Log("File Load Success");
resultText = sr.ReadToEnd();
sr.Close();
return resultText;
}
public void Close() {this.Close();}
}



덧글