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!
https://mob-sakai.github.io/UIEffect/
MIT License
5.79k stars 795 forks source link
blur burn component contrast edge-detection effect grayscale hsv-color melt pixelation posterize retro rgb-shift sepia shader tweener ugui ui unity unity3d

logo UIEffect v5



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 uGUI, simply and powerfully."
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!



📌 Key Features



🎮 Demo


WebGL Demo



⚙ Installation

This package requires Unity 2020.3 or later.

Install via OpenUPM

Install via UPM (with Package Manager UI)

Install via UPM (Manually)

Install as Embedded Package

  1. Download a source code zip file from Releases and extract it.
  2. Place <extracted_dir>/Packages/src directory in your project's Packages directory.
    • You can rename the src directory.
    • If you want to fix bugs or add features, install it as an embedded package.
    • To update the package, you need to re-download it and replace the contents.

Additional Resource Imports

UIEffect includes additional resources to import.



🔄 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",
  2. Import the v4 Compatible Components sample from the Package Manager window.

  3. All v4 components are obsolete.

    • v4 UIEffect component is now UIEffectV4 component. Change the reference in the code.
    • The effectArea property in some components are not supported in v5.
    • UIShadow, UIGradient, UIFlip components are not supported in v5.
    • v4 components can be converted to v5 UIEffect component by selecting Convert To UIEffect from the context menu.



🚀 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. Adjust the effect filters and parameters in the inspector.

  4. Enjoy!



Component: UIEffect

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



Component: UIEffectTweener

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



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

UIEffect supports TextMeshProUGUI elements. To use UIEffect with TextMeshPro, follow 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.



Runtime/Editor Preset for UIEffect

You can create and use presets for UIEffect components.



Usage with Code

You can control the effect settings and animations via code.

var effect = graphic.AddComponent<UIEffect>();

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

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

// Add a tweener
var tweener = graphic.AddComponent<UIEffectTweener>();
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)



:warning: 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.md and 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