Instantly share code, notes, and snippets.

What would you like to do?
Changing StandardAsset ImageEffects on Camera at runtime in Unity
using DG.Tweening; // remove this if you're not using DOTween
using System.Collections;
using UnityEngine;
using UnityStandardAssets.ImageEffects;
/// <summary>
/// An extension class for dynamically adding noise to the camera easily at runtime
/// </summary>
public class DynamicCameraEffects : MonoBehaviour
private static NoiseAndGrain _noiseScript;
private void Start()
_noiseScript = GetComponent<NoiseAndGrain>();
public static void BringTheNoise(float newIntensity, float duration)
DOTween.To(() => _noiseScript.intensityMultiplier, x => _noiseScript.intensityMultiplier = x, newIntensity, duration)
private static void RemoveNoise()
var duration = Random.Range(0.2f, 1f);
DOTween.To(() => _noiseScript.intensityMultiplier, x => _noiseScript.intensityMultiplier = x, 0.45f, duration)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment