Skip to content

Instantly share code, notes, and snippets.

@vend9520
Last active September 4, 2016 07:51
Show Gist options
  • Select an option

  • Save vend9520/f3a47598227105943775846f6f191479 to your computer and use it in GitHub Desktop.

Select an option

Save vend9520/f3a47598227105943775846f6f191479 to your computer and use it in GitHub Desktop.
外部テキストファイルの読み込み
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