UBlur Scripting Guide


UBlur is designed for non coder devs, but it also provides APIs and properties for you to script. In this article we will explain and demonstrate how to control UBlur by script.

Before anything start..

You’ll need to do this first:

This enables you to access the UBlur’s namespace, so your script should look like this now:

You can either dynamically attach a UBlur script to a UGUI gameobject or do it in editing time and make it as a public monoBehaviour var.
Let’s use the first method as an example:

Good. Now we have the basic script setup. Let’s do some real demo.

Enable / Disable effects

UBlur provides interfaces for disable / enable effects. Right now UBlur provides two types of effect.
Here’s how you do it:

Say if I want to enable the blur effect right after a UBlur component is added:

Just attach this simple script to a UGUI Image and hit play and you’ll see.

Access and control effects

Once you have your effects enabled, you’ll see effect right away. But what if I want to make it blur more? Like the iOS UI?
UBlur lets you access to the effects’ variables directly:

Here’s a quick example for making an iOS like UGUI panel: (Use this script on the default UGUI panel)

And yes, these variables are accessible by Unity Animation. You know the drill.

Modify margins

Sometimes your panel has borders. In such case you may want to leave the panel’s borders unaffected by image effects.
UBlur provides you to set the effect area’s margins:

Let’s give our iOS like panel a bit of margin:

Disable / Enable UBlur

Finally, you can disable or enable UBlur just like other components. This will turn off/on the effects immediately:

That’s all about UBlur scripting!
Yeah, it’s that simple!
We’re looking forward to improving this nice little toy. If you have an idea or would like to comment, please don’t hesitate to send me an email.
Happy coding!

Basic Setup

Live Demo

Asset Store Link

Looking For Support?