Skip to content

Instantly share code, notes, and snippets.

@phoenixperry
Created November 1, 2017 20:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phoenixperry/33b0b4b2f460a10f5c8915f12423f2e1 to your computer and use it in GitHub Desktop.
Save phoenixperry/33b0b4b2f460a10f5c8915f12423f2e1 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