Hello Everyone!
I’m attaching the Blur(JS) script to my Main Camera and I was trying to get the “background” to blur when I hover over something. I kind of have it working but I have 2 issues:
- How can I have things on another layer that aren’t getting blurred by the main camera
- I can’t get it to lerp smoothly between values.
Here is what I have so far.
using UnityEngine;
using System.Collections;
public class BlurBGWhenOver : MonoBehaviour {
Blur cameraBlur;
// Use this for initialization
void Start () {
cameraBlur = Camera.main.GetComponent<Blur>();
}
// Update is called once per frame
void Update () {
}
void OnMouseEnter(){
cameraBlur.enabled = true;
cameraBlur.blurSize = Mathf.Lerp (cameraBlur.blurSize, 4, Time.deltaTime * 2);
}
void OnMouseExit(){
cameraBlur.enabled = false;
cameraBlur.blurSize = Mathf.Lerp (cameraBlur.blurSize, 0, Time.deltaTime * 2);
}
}
So again, why is this not lerping smoothly between values. How can I put the quad on another layer so that when the main camera blurs the “background” the things I want to remain in the foreground don’t get blurred. Thanks so much!