Files
UltimateFishing/Assets/Scripts/Assembly-CSharp/SetCustomDepthNormalShader.cs
2026-02-21 16:45:37 +08:00

36 lines
674 B
C#

using UnityEngine;
using UnityEngine.Rendering;
public class SetCustomDepthNormalShader : MonoBehaviour
{
public Shader depthNormalShader;
private void Start()
{
SetCustomShader();
}
private void Awake()
{
SetCustomShader();
}
private void OnValidate()
{
SetCustomShader();
}
private void SetCustomShader()
{
if (depthNormalShader != null)
{
GraphicsSettings.SetShaderMode(BuiltinShaderType.DepthNormals, BuiltinShaderMode.UseCustom);
GraphicsSettings.SetCustomShader(BuiltinShaderType.DepthNormals, depthNormalShader);
}
else
{
GraphicsSettings.SetShaderMode(BuiltinShaderType.DepthNormals, BuiltinShaderMode.UseBuiltin);
}
}
}