|
|
|
|
|
|
using UnityEditor.Experimental.AssetImporters; |
|
|
|
using UnityEditor.ShaderGraph.Drawing; |
|
|
|
|
|
|
|
[ScriptedImporter(10, ShaderGraphImporter.ShaderGraphExtension)] |
|
|
|
[ScriptedImporter(11, ShaderGraphImporter.ShaderGraphExtension)] |
|
|
|
public class ShaderGraphImporter : ScriptedImporter |
|
|
|
{ |
|
|
|
public const string ShaderGraphExtension = "shadergraph"; |
|
|
|
|
|
|
var text = GetShaderText<MaterialGraph>(ctx.assetPath, out configuredTextures); |
|
|
|
if (text == null) |
|
|
|
text = errorShader; |
|
|
|
|
|
|
|
|
|
|
|
var name = Path.GetFileNameWithoutExtension(ctx.assetPath); |
|
|
|
string shaderName = string.Format("graphs/{0}", name); |
|
|
|
text = text.Replace("Hidden/GraphErrorShader2", shaderName); |
|
|
|
|
|
|
} |
|
|
|
RegisterShaders(importedAssets); |
|
|
|
} |
|
|
|
} |
|
|
|
} |