Files
UltimateFishing2020/Assets/Scripts/Assembly-CSharp/ARTNGAME/Skymaster/CopyShadowMapSM.cs
2026-03-04 10:03:45 +08:00

33 lines
731 B
C#

using UnityEngine;
using UnityEngine.Rendering;
namespace Artngame.SKYMASTER
{
[ExecuteInEditMode]
public class CopyShadowMapSM : MonoBehaviour
{
private CommandBuffer cb;
private void OnEnable()
{
Light component = GetComponent<Light>();
if ((bool)component)
{
cb = new CommandBuffer();
cb.name = "CopyShadowMap";
cb.SetGlobalTexture("_DirectionalShadowMask", new RenderTargetIdentifier(BuiltinRenderTextureType.CurrentActive));
component.AddCommandBuffer(LightEvent.AfterScreenspaceMask, cb);
}
}
private void OnDisable()
{
Light component = GetComponent<Light>();
if ((bool)component)
{
component.RemoveCommandBuffer(LightEvent.AfterScreenspaceMask, cb);
}
}
}
}