LoginSignup
2
2

More than 3 years have passed since last update.

UnityでTextファイルを出力する方法

Posted at

Textファイルに変数を出力する方法

using UnityEngine;
using System.IO;

public class Output : MonoBehaviour
{
    int[] num ={0,1,2,3,4};

    // Start is called before the first frame update
    void Start()
    {
        StreamWriter sw = new StreamWriter("./Assets/TextData.txt",false); // TextData.txtというファイルを新規で用意

        foreach (int i in num)
        {
            sw.WriteLine(i);// ファイルに書き出したあと改行
        }

        sw.WriteLine("おわり");

        sw.Flush();
        sw.Close();

    }
}
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2