You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
HighGroundRoyaleNetcode/Assets/JMO Assets/Cartoon FX Remaster/CFXR Assets/Editor/CFXR_ShaderPostProcessor.cs

38 lines
1.2 KiB
C#

using System;
using UnityEditor;
using UnityEngine;
namespace CartoonFX
{
namespace CustomShaderImporter
{
public class CFXR_ShaderPostProcessor : AssetPostprocessor
{
static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
{
CleanCFXRShaders(importedAssets);
}
static void CleanCFXRShaders(string[] paths)
{
foreach (var assetPath in paths)
{
if (!assetPath.EndsWith(CFXR_ShaderImporter.FILE_EXTENSION, StringComparison.InvariantCultureIgnoreCase))
{
continue;
}
var shader = AssetDatabase.LoadMainAssetAtPath(assetPath) as Shader;
if (shader != null)
{
ShaderUtil.ClearShaderMessages(shader);
if (!ShaderUtil.ShaderHasError(shader))
{
ShaderUtil.RegisterShader(shader);
}
}
}
}
}
}
}