Last active
September 4, 2016 07:51
-
-
Save vend9520/f3a47598227105943775846f6f191479 to your computer and use it in GitHub Desktop.
外部テキストファイルの読み込み
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using UnityEngine; | |
| using System.Collections; | |
| public class readText : MonoBehaviour { | |
| void Start () { | |
| //resourcesフォルダ内にあるsampleTextファイルをロード | |
| TextAsset textAsset = Resources.Load("sampleText") as TextAsset; | |
| //ロードした中身をstring型に変換 | |
| string text = textAsset.text; | |
| //1行ずつに分割 | |
| string[] row = text.Split('\n'); | |
| for (int i = 0; i < row.Length; i++) { | |
| Debug.Log(row[i]); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment