GitHub - mob-sakai/UIEffect: UIEffect is an open-source package that allows you to intuitively apply rich UI effects directly from the Inspector or via code. Combine various filters, such as grayscale, blur, and dissolve, to decorate your UI with a unique visual style! (original) (raw)




PRs Welcome

<< ๐Ÿ“ Description | ๐Ÿ“Œ Key Features | ๐ŸŽฎ Demo | โš™ Installation | ๐Ÿ”„ Upgrading from v4 to v5 | ๐Ÿš€ Usage | ๐Ÿค Contributing >>

โš ๏ธ This README is for v5. For v4, please visit here.

๐Ÿ“ Description

"Decorate your UI, simply and powerfully."

UIEffect is a powerful, open-source Unity package that transforms your UI with stunning visual effects.
Apply professional-grade filters like grayscale, blur, and dissolve directly from the Inspectorโ€”no coding required!

โœจ Perfect for: Game developers, UI designers, and anyone looking to enhance their Unity UI with minimal effort

๐Ÿ“Œ Key Features

๐ŸŽฎ Demo



Try the WebGL Demo

โš™ Installation

This package requires Unity 2020.3 or later.

Install via OpenUPM

openupm add com.coffee.ui-effect  
openupm add com.coffee.ui-effect@5.9.0  

Install via UPM (with Package Manager UI)

Install via UPM (Manually)

Install as Embedded Package

  1. Download the Source code (zip) file from Releases and extract it.
  2. Move the <extracted_dir>/Packages/src directory into your project's Packages directory.
    • You can rename the src directory if needed.
    • If you intend to fix bugs or add features, installing it as an embedded package is recommended.
    • To update the package, re-download it and replace the existing contents.

Import Additional Resources

Additional resources can be imported to extend functionality.

๐Ÿ”„ Upgrading from v4 to v5

If upgrading from UIEffect v4 to v5, note the following breaking changes:

  1. If you are installing via git URL, add ?path=Packages/src. The default branch is changed upm to main.
    // v4
    "com.coffee.ui-effect": "https://github.com/mob-sakai/UIEffect.git",
    "com.coffee.ui-effect": "https://github.com/mob-sakai/UIEffect.git#upm",
    // v5
    "com.coffee.ui-effect": "https://github.com/mob-sakai/UIEffect.git?path=Packages/src",
    "com.coffee.ui-effect": "https://github.com/mob-sakai/UIEffect.git?path=Packages/src#main",
  2. Import the v4 Compatible Components sample from the Package Manager window.
  3. All v4 components are obsolete.

๐Ÿš€ Usage

Getting Started

  1. Install the package.
  2. Add a UIEffect component to a UI element (Image, RawImage, Text, TextMeshProUGUI, etc...) from the Add Component in the inspector or Component > UI > UIEffect menu.
  3. Set Tone Filter to Grayscale and Tone Intensity to 1.0.
  4. Try other effect filters and parameters in the inspector.
  5. From the top menu, you can load/append preset.

    [!TIP]
    Load overwrites all properties with the preset, while Append only overwrites enabled filters and modes with the preset.
    You can easily build effects by combining them with Append.

  6. Enjoy!

Component: UIEffect

The UIEffect component applies visual effects to UI elements, allowing various effects to be achieved by combining multiple filters.

Tip

From the top menu, you can load and save the editor presets or clear settings.
For details, refer to the Runtime/Editor Preset for UIEffect.

Tone Filter

Color Filter

Sampling Filter

Transition Filter

Tip

Transition Tex applies transitions using its alpha channel.
If you use Scale, Offset, or Speed, set Wrap Mode = Repeat in the texture import settings.
For details, refer to the textures included in the built-in presets.

Target Mode

Blend Type

Shadow Mode

Gradation Mode

Edge Mode

Detail Filter

Flip

Others

Tip

Transition Filter, Gradation Filter, and Detail Filter usually refer to their own RectTransform when applying effects.
For example, if the mesh shape exceeds the RectTransform boundaries, the effect may not be applied correctly.
By specifying Custom Root, you can refer to the specified transform.

Component: UIEffectTweener

The UIEffectTweener component animates the effect, enabling easy control over effect animations without the need for an AnimationClip.

You can preview the animation using the seek bar and play button.

Component: UIEffectReplica

The UIEffectReplica component applies visual effects to UI elements by replicating the settings of another UIEffect component. This allows the same effect to be applied across multiple UI elements simultaneously.

Usage with TextMeshPro

To use UIEffect with TextMeshPro, you need to import additional resources.
When a shader included in the samples is requested, an import dialog will automatically appear.
Click the Import button.

Alternatively, you can manually import the resources by following these steps:

  1. First, you must import TMP Essential Resources before using.
  2. Open the Package Manager window and select the UI Effect package in the package list and click the TextMeshPro Support > Import button.
    โš ๏ธ If you are using Unity 2023.2/6000.0+ or TextMeshPro 3.2/4.0+, click the TextMeshPro Support (Unity 6) > Import button instead.
  3. The assets will be imported under Assets/Samples/UI Effect/{version}.
  4. Add the UIEffect component to a TextMeshProUGUI element and adjust the effect settings. The <font> and <sprite> tags are also supported.

Tip

TextMeshPro Support may change with updates to the UIEffect package.
If issues occur, try importing it again.

Tip

If you have moved TMPro_Properties.cginc and TMPro.cginc from their default install path (Assets/TextMesh Pro/Shaders/...), you will need to manually update the paths in the shaders underTextMeshPro Support or TextMeshPro Support (Unity 6).

Usage with SoftMaskForUGUI

SoftMaskForUGUI is a package that allows you to create soft masks for UI elements.

SoftMaskForUGUI (v3.3.0+) supports UIEffect (v5.7.0+).
When a shader included in the samples is requested, an import dialog will automatically appear.
Click the Import button.

Usage with ShaderGraph

โš ๏ธ ShaderGraph support is available only in Unity 2023.2/6.0 or later.

To use UIEffect with ShaderGraph, you need to import additional resources.

  1. Open the Package Manager window and select the UI Effect package in the package list and click the ShaderGraph Support (Unity6, BuiltIn) > Import button.
    โš ๏ธ If you are using Universal Render Pipeline (URP), click the ShaderGraph Support (Unity6, URP) > Import button.
  2. The assets will be imported under Assets/Samples/UI Effect/{version}.
  3. Change the sub target (Material) of the existing ShaderGraph file to Canvas (UIEffect).
    Alternatively, create a new ShaderGraph from Assets/Create/Shader Graph/BuiltIn/Canvas Shader Graph (UIEffect).

Tip

Use (UIEffect) in the shader name or register as an optional shader in ProjectSettings.

Usage with Timeline

Timeline is a powerful animation tool that can control UIEffect using ControlTrack and UIEffect tracks.

Runtime/Editor Preset for UIEffect

You can create and use presets for UIEffect components.

Tip

Editor presets are saved in the UIEffectPresets directory. You can also create subdirectories to customize the preset menu.

Usage with Code

You can control the effect settings and animations via code.

var effect = graphic.AddComponent();

// Apply a runtime preset effect.LoadPreset("Dissolve");

// Set the effect parameters effect.transitionWidth = 0.1f; effect.transitionColor = Color.red;

// Add a tweener var tweener = graphic.AddComponent(); tweener.cullingMask = UICullingMask.Tone; tweener.wrapMode = UIWrapMode.PingPongLoop;

// Warm up the shader variant collection. UIEffectProjectSettings.shaderVariantCollection.WarmUp();

Project Settings

You can adjust the project-wide settings for UIEffect. (Edit > Project Settings > UI > UIEffect)

Settings

Important

Editor

Shader

Important

โš ๏ธ Limitations

Here are the limitations of UIEffect:

๐Ÿค Contributing

Issues

Issues are incredibly valuable to this project:

Pull Requests

Pull requests offer a fantastic way to contribute your ideas to this repository.
Please refer to CONTRIBUTING.mdand use develop branch for development.

Support

This is an open-source project developed during my spare time.
If you appreciate it, consider supporting me.
Your support allows me to dedicate more time to development. ๐Ÿ˜Š


License

Author

See Also