32 lines
949 B
C#
32 lines
949 B
C#
using System.IO;
|
|
using UnityEngine;
|
|
using UnityEngine.Rendering.HighDefinition;
|
|
|
|
namespace Misaki.ArtToolEditor
|
|
{
|
|
internal class CreateDecalProcessor : IAssetsProcessor
|
|
{
|
|
public void OnPreProcess(AssetsProcessContext context)
|
|
{
|
|
}
|
|
|
|
public void OnProcess(UnityEngine.Object source, string outputDirectory, AssetsProcessContext context)
|
|
{
|
|
if (source is not Material mat)
|
|
{
|
|
return;
|
|
}
|
|
|
|
var outputPath = Path.Combine(outputDirectory, mat.name + ".prefab");
|
|
var decal = AssetCreationHelpers.CreateDecal(outputPath);
|
|
|
|
mat.shader = Shader.Find(Constants.ShaderPath.DECAL_SHADER_PATH);
|
|
decal.transform.rotation = Quaternion.Euler(90, 0, 0);
|
|
decal.GetComponent<DecalProjector>().material = mat;
|
|
}
|
|
|
|
public void OnPostProcess(AssetsProcessContext context)
|
|
{
|
|
}
|
|
}
|
|
} |