ok, so my idea is to simply create an empty .txt file in the assets folder. ive tried using the c# system.io but to no avail, so i figured id try using unity’s built in textasset - still no luck. whenever i run the script i get a “NullReferenceException” on the line that creates the file, but idk where the problem is.
any help would be greatly appreciated
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.IO;
public class SceneItem : Editor {
[MenuItem( "Test UI/this is a test" )]
public static void OpenMenu() {
}
[MenuItem("Test UI/submenu test/create asset")]
static void OpenSubMenu() {
var textFileToBeCreated = new TextAsset();
AssetDatabase.CreateAsset(textFileToBeCreated, "Assets/NewObject.txt");
AssetDatabase.Refresh();
}
}