So, as is the code works fine, however it only create one txt file, I would like it to create a new file each time it is run and Ideally create a folder within Unity to store all these rather than just in the assets folder.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.IO;
using Unity.UI;
public class Hippocampus : MonoBehaviour
{
QuoteText qT;
void OnEnable ()
{
qT = FindObjectOfType<QuoteText>();
}
public void CreateText()
{
string path = Application.dataPath + "/Job" + 01 + ".txt"; // file path and name of the file TODO: growing list, also create a new folder or directory like: @"E:\Project\C_Sharp\Tutorial\Console_App\FileSystem\Output\"; for example
if (!File.Exists(path))
{
File.WriteAllText(path, + qT.area + "m² \n\n");
}
string content = "$" + qT.sqreMeterRate * qT.area + "\n" +
qT.tileMod + "\n" +
qT.ironMod + "\n" +
qT.roofFall + "\n" +
qT.snowMod + "\n" +
qT.skyLightMod + "\n" +
qT.hotWaterMod + "\n" +
qT.boxGutterMod + "\n" +
qT.ceilingMod + "\n" +
qT.overSizedMod + "\n" +
qT.floorLevel + "\n" +
qT.rakingMod + "\n" +
qT.solidRaftersMod + "\n" +
qT.aCMod + "\n" +
qT.ductingMod + "\n" +
qT.commercialMod+ "\n";
File.AppendAllText(path, content);
}
}
Thanks for the help