ReduceResolutionAndBlendUI.cs 885 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using System;
  2. using UnityEngine;
  3. public class ReduceResolutionAndBlendUI : MonoBehaviour
  4. {
  5. public static void Init()
  6. {
  7. ReduceResolutionAndBlendUI.Instance = R.Ui.CameraGO.AddComponent<ReduceResolutionAndBlendUI>();
  8. }
  9. private void OnPreRender()
  10. {
  11. RenderTexture gamePlayRenderTexture = ReduceResolutionAndBlend.Instance.GamePlayRenderTexture;
  12. if (gamePlayRenderTexture)
  13. {
  14. Graphics.Blit(gamePlayRenderTexture, null, this._material);
  15. }
  16. }
  17. private void Awake()
  18. {
  19. if (!this.BlendShader)
  20. {
  21. this.BlendShader = Shader.Find("Hidden/BlendTwoRenderTexture");
  22. }
  23. if (!this._material)
  24. {
  25. this._material = new Material(this.BlendShader);
  26. }
  27. }
  28. private void Start()
  29. {
  30. }
  31. private void Update()
  32. {
  33. }
  34. public Shader BlendShader;
  35. private Material _material;
  36. public static ReduceResolutionAndBlendUI Instance;
  37. }