using System; using UnityEngine; public class ScreenLoading : PostEffectsBase { public override bool CheckResources() { this.CheckSupport(false); this.overlayMaterial = this.CheckShaderAndCreateMaterial(this.overlayShader, this.overlayMaterial); if (!this.isSupported) { this.ReportAutoDisable(); } return this.isSupported; } private void OnRenderImage(RenderTexture source, RenderTexture destination) { if (!this.CheckResources()) { Graphics.Blit(source, destination); return; } Vector4 value = new Vector4(1f, 0f, 0f, 1f); this.overlayMaterial.SetVector("_UV_Transform", value); this.overlayMaterial.SetFloat("_Intensity", this.intensity); this.overlayMaterial.SetTexture("_Overlay", this.texture); Graphics.Blit(source, destination, this.overlayMaterial, (int)this.blendMode); } public ScreenLoading.OverlayBlendMode blendMode = ScreenLoading.OverlayBlendMode.Overlay; public float intensity = 1f; public Texture2D texture; public Shader overlayShader; private Material overlayMaterial; public enum OverlayBlendMode { Additive, ScreenBlend, Multiply, Overlay, AlphaBlend } }