- Home /
Health blur effect
Does anyone know how to add a blurry effect when your character gets hurt (without the blood all in his eye) and make it go all black and white when they have pretty much have %1 plz respond
Answer by MentalSieve · May 03, 2015 at 04:43 PM
I apologize if this is obvious or not what you're looking for, but have you tried adding a translucent (ie with a low alpha value) canvas/UI layer, and use a script to tie it to the player's health value?
for example:
if (playerHealth <= totalHealth * 0.1f)
{bloodBlur.SetActive(true)}
else
{bloodBlur.SetActive(false)}
Answer by roddles · May 04, 2015 at 09:34 AM
Assuming you are using Unity 5 or you have Unity 4.x Pro, you can add the Blur effect to your current camera and then programmatically enable or adjust the blur value. Here's how you can get Unity's blur shader onto your camera:
Assets menu -> Import Package -> Effects (will only be available on Unity 5 or Unity 4.x Pro)
Click OK to import the assets into your project
In the Project browser, go to Assets/Standard Assets/Effects/Image Effects/Scripts
Find the Blur or BlurOptimized script and drag it onto your Camera in the Hierarchy view (or onto the Inspector if your camera is selected).
You can now control the variables Blur or Blur Optimized script as you would another script. E.g.:
Camera cam = GameObject.FindGameObjectWithTag("MainCamera");
BlurOptimized blur = (BlurOptimized) cam.GetComponent(typeof(BlurOptimized));
blur.enabled = true;
Your answer
![](https://koobas.hobune.stream/wayback/20220613194508im_/https://answers.unity.com/themes/thub/images/avi.jpg)