(Unity)読み込んだテキストファイル内の文字を画面に表示する(その1)

1)UI(=文字を画面に表示するため)の準備


2)テキストファイルのインポート


3)スクリプトの作成

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class LoadText : MonoBehaviour
{
    [SerializeField]
    private Text textLabel;

    [SerializeField]
    private TextAsset textFile;

    private string textData;

    void Start()
    {
        textData = textFile.text;
        textLabel.text = textData;
    }
}

 


4)設定

 


5)再生して確認