Skip to content

Instantly share code, notes, and snippets.

@phoenixperry
Created November 1, 2017 20:24
Show Gist options
  • Save phoenixperry/1ca588c972694554d079aa9d5f0ed79f to your computer and use it in GitHub Desktop.
Save phoenixperry/1ca588c972694554d079aa9d5f0ed79f to your computer and use it in GitHub Desktop.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.IO;
public class FileWriting : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update()
{
Vector3 position = new Vector3(Random.Range(-10.0f, 10.0f), 0, Random.Range(-10.0f, 10.0f));
this.transform.localScale = position;
WriteString(position);
}
StreamWriter writer;
string path = "Assets/Resources/test.txt";
void WriteString(Vector3 pos_)
{
//Write some text to the test.txt file
writer = new StreamWriter(path, true);
writer.WriteLine("Test" + pos_.ToString());
writer.Close();
writer.Dispose();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment