I see some indie games has a cutscene in it. Like when he wakes up, the blur effect used in it and the blur increase and decrease. Is it possible to animate the blur? I want to make in-game cutscene.
Do I need a script to do this?
I see some indie games has a cutscene in it. Like when he wakes up, the blur effect used in it and the blur increase and decrease. Is it possible to animate the blur? I want to make in-game cutscene.
Do I need a script to do this?
Here’s an example. In this C# example, you’ll adjust the blur amount by pressing +/- on the num key pad. When blur is at minimum, it will be disabled, otherwise, enabled.
using UnityEngine;
using System.Collections;
public class Example : MonoBehaviour
{
float min = 0;
float max = 5;
float blur;
float increment = 0.1f;
void Awake()
{
blur = GetComponent<BlurEffect>().blurSpread;
}
void Update()
{
GetComponent<BlurEffect>().blurSpread = blur;
if(Input.GetKey (KeyCode.KeypadPlus) && blur < max)
blur += increment;
if(Input.GetKey (KeyCode.KeypadMinus) && blur > min)
blur -= increment;
if(blur <= min)
GetComponent<BlurEffect>().enabled = false;
else
GetComponent<BlurEffect>().enabled = true;
}
}