- Home /
How would I apply a camera image effect with increasing intensity as the enemy gets closer to the player?
Hi all,
I am trying to add the chromatic aberration camera effect when the player gets close the enemy. I have this script, but I was wondering how I could make the effect increase as the player gets closer to the enemy.
using UnityEngine;
using System.Collections;
using UnitySampleAssets.ImageEffects;
public class ChangeCamEffects : MonoBehaviour {
public GameObject MainCam;
public void DoStuff() {
MainCam.GetComponent<VignetteAndChromaticAberration> ().chromaticabberation= 5;
}
}
Comment