您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

23 行
725 B

using System.IO;
using System.Text;
using UnityEditor.Experimental.AssetImporters;
using UnityEngine;
using UnityEngine.MaterialGraph;
[ScriptedImporter(1, "ShaderRemapGraph")]
public class MasterRemapGraphImporter : ScriptedImporter
{
public override void OnImportAsset(AssetImportContext ctx)
{
var textGraph = File.ReadAllText(ctx.assetPath, Encoding.UTF8);
var graph = JsonUtility.FromJson<MasterRemapGraph>(textGraph);
if (graph == null)
return;
var graphAsset = ScriptableObject.CreateInstance<MasterRemapGraphAsset>();
graphAsset.remapGraph = graph;
ctx.AddObjectToAsset("MainAsset", graphAsset);
ctx.SetMainObject(graphAsset);
}
}