|
|
|
|
|
|
using System.IO; |
|
|
|
using UnityEditor.ProjectWindowCallback; |
|
|
|
|
|
|
|
namespace UnityEditor.ShaderGraph |
|
|
|
{ |
|
|
|
public class CreateUnlitShaderGraph : EndNameEditAction |
|
|
|
{ |
|
|
|
[MenuItem("Assets/Create/Shader/Unlit Graph", false, 208)] |
|
|
|
public static void CreateMaterialGraph() |
|
|
|
{ |
|
|
|
ProjectWindowUtil.StartNameEditingIfProjectWindowExists(0, CreateInstance<CreateUnlitShaderGraph>(), |
|
|
|
"New Shader Graph.ShaderGraph", null, null); |
|
|
|
} |
|
|
|
|
|
|
|
public override void Action(int instanceId, string pathName, string resourceFile) |
|
|
|
{ |
|
|
|
var graph = new MaterialGraph(); |
|
|
|
graph.AddNode(new UnlitMasterNode()); |
|
|
|
File.WriteAllText(pathName, EditorJsonUtility.ToJson(graph)); |
|
|
|
AssetDatabase.Refresh(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |