您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
23 行
792 B
23 行
792 B
using System.IO;
|
|
using UnityEditor.ProjectWindowCallback;
|
|
using UnityEngine.Graphing;
|
|
|
|
namespace UnityEditor.Graphing
|
|
{
|
|
public class CreateSerializableGraph : EndNameEditAction
|
|
{
|
|
[MenuItem("Assets/Create/Serializable Graph", false, 207)]
|
|
public static void CreateMaterialGraph()
|
|
{
|
|
ProjectWindowUtil.StartNameEditingIfProjectWindowExists(0, CreateInstance<CreateSerializableGraph>(),
|
|
"New Shader Graph.ShaderGraph", null, null);
|
|
}
|
|
|
|
public override void Action(int instanceId, string pathName, string resourceFile)
|
|
{
|
|
var graph = CreateInstance<SerializableGraphAsset>();
|
|
graph.name = Path.GetFileName(pathName);
|
|
AssetDatabase.CreateAsset(graph, pathName);
|
|
}
|
|
}
|
|
}
|