Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class FileInOut : MonoBehaviour {
- string plainText = "";
- TextMesh textmesh;
- // Use this for initialization
- void Start () {
- textmesh = GameObject.Find ("Text").GetComponent<TextMesh> ();
- //test if Text changes normally
- textmesh.text = "Hallo";
- //create the text file and put text into it
- #if WINDOWS_UWP
- Task task = new Task(
- async () =>
- {
- StorageFolder storageFolder = ApplicationData.Current.LocalFolder;
- StorageFile textFileForWrite = await storageFolder.CreateFileAsync("LocalText.txt");
- await FileIO.WriteTextAsync(textFileForWrite, "Test Start");
- });
- task.Start();
- task.Wait();
- #endif
- }
- // Update is called once per frame
- void Update () {
- //Read the text file and change the text of 3D text to it (not working)
- #if WINDOWS_UWP
- Task task = new Task(
- async () =>
- {
- StorageFolder storageFolder = ApplicationData.Current.LocalFolder;
- StorageFile textFileforRead = await storageFolder.GetFileAsync("LocalText.txt");
- plainText = await FileIO.ReadTextAsync(textFileforRead);
- textmesh.text = plainText;
- });
- task.Start();
- task.Wait();
- #endif
- }
- }
Add Comment
Please, Sign In to add comment