public override void Action(int instanceId, string pathName, string resourceFile) { var p = new EcsPreProcessor(_config, pathName); var data = p.ProcessScript(_template.Code); using (var f = File.CreateText(pathName)) { f.Write(data); } var newFilePath = Path.Combine(Path.GetDirectoryName(pathName) ?? "", Path.GetFileNameWithoutExtension(pathName) + ".cs"); File.Move(pathName, newFilePath); AssetDatabase.Refresh(); }
/* uncomment lines below to add custom items to context menu*/ //[MenuItem("Assets/Create Script/{NAME}", priority = 19)] //private static void CreateCustomScript() //{ // EcsScriptTemplate.CreateScript("{TEMPLATENAME}"); //} public static void ProcessPreProcessor(EcsPreProcessor p) { // add code here if you wish to adjust preprocessor // example //p.Tags.Add("custom", "put value here"); }