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

36 lines
707 B
C#

using UnityEngine;
[ExecuteInEditMode]
public class CopyToScreenRT : MonoBehaviour
{
private RenderTexture activeRT;
private void OnPostRender()
{
if (GetComponent<Camera>().actualRenderingPath == RenderingPath.DeferredShading)
{
activeRT = RenderTexture.active;
}
else
{
activeRT = null;
}
}
private void OnRenderImage(RenderTexture src, RenderTexture dest)
{
if (GetComponent<Camera>().actualRenderingPath == RenderingPath.DeferredShading && (bool)activeRT)
{
if (src.format == activeRT.format)
{
Graphics.Blit(src, activeRT);
}
else
{
Debug.LogWarning("Cant resolve texture, because of different formats!");
}
}
Graphics.Blit(src, dest);
}
}