Game Development Reference
In-Depth Information
Importing text files into Unity as TextAssets
You can access the file and its text data from any script file by exposing a TextAsset
public member, as shown in the following code sample 6-25:
//--------------------------------------------------
using UnityEngine;
using System.Collections;
//--------------------------------------------------
public class TextFileAccess : MonoBehaviour
{
//Reference a text file
public TextAsset TextData = null;
// Use this for initialization
void Start ()
{
//Display text in file
 
Search WWH ::




Custom Search