您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
24 行
865 B
24 行
865 B
using System.IO;
|
|
using UnityEditor.ProjectWindowCallback;
|
|
|
|
namespace UnityEditor.ShaderGraph
|
|
{
|
|
class CreateUnlitShaderGraph : EndNameEditAction
|
|
{
|
|
[MenuItem("Assets/Create/Shader/Unlit Graph", false, 208)]
|
|
public static void CreateMaterialGraph()
|
|
{
|
|
ProjectWindowUtil.StartNameEditingIfProjectWindowExists(0, CreateInstance<CreateUnlitShaderGraph>(),
|
|
string.Format("New Shader Graph.{0}", ShaderGraphImporter.Extension), null, null);
|
|
}
|
|
|
|
public override void Action(int instanceId, string pathName, string resourceFile)
|
|
{
|
|
var graph = new GraphData();
|
|
graph.AddNode(new UnlitMasterNode());
|
|
graph.path = "Shader Graphs";
|
|
File.WriteAllText(pathName, EditorJsonUtility.ToJson(graph));
|
|
AssetDatabase.Refresh();
|
|
}
|
|
}
|
|
}
|