Skip to content

Instantly share code, notes, and snippets.

@kaiware007
Created May 22, 2017 16:26
Show Gist options
  • Save kaiware007/9b78aa901183fb2a5e99ab76fe3ccee8 to your computer and use it in GitHub Desktop.
Save kaiware007/9b78aa901183fb2a5e99ab76fe3ccee8 to your computer and use it in GitHub Desktop.
Vector3をファイルに保存する
using System.IO;
using UnityEngine;
public static class Dump
{
public static void DumpVector3(Vector3[] datas, string fileName)
{
StreamWriter sw;
string date = System.DateTime.Now.ToString("yyyyMMddtthhmmss");
string filePath = Application.dataPath + "/../" + fileName + "_" + date + ".txt";
sw = new StreamWriter(filePath, false); //true=追記 false=上書き
for (int i = 0; i < datas.Length; i++)
{
sw.WriteLine(i + "," + datas[i].x + "," + datas[i].y + "," + datas[i].z);
}
sw.Flush();
sw.Close();
Debug.Log("Dump " + filePath);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment