Global Game Jam 2022
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
610 B

  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. [ExecuteAlways]
  5. public class ApplyImageEffect : MonoBehaviour
  6. {
  7. [SerializeField]
  8. private Shader m_imageEffect;
  9. [SerializeField]
  10. private Material m_mat;
  11. private void Awake()
  12. {
  13. if (m_imageEffect != null && m_mat == null)
  14. {
  15. m_mat = new Material(m_imageEffect);
  16. }
  17. }
  18. private void OnRenderImage(RenderTexture source, RenderTexture destination)
  19. {
  20. if (m_mat != null)
  21. {
  22. Graphics.Blit(source, destination, m_mat);
  23. }
  24. }
  25. }