UniFader 
UniFader is a transition helper components for Unity.
Supported Unity versions
Unity 2019.3 or higher.
Quick Start
- Download
UniFader.unitypackage
from releases page and import it. - You can transition scene by calling only
UniFader.Instance.LoadSceneWithFade(0)
. - Enjoy!
Samples can be seen in Sample
folder if you want.
Description
You can use two transition types - Color Fade
and Gradient Mask Fade
.
Fade Pattern | Feature | Screenshot |
---|---|---|
Color Fade | Simple color fade effect. You can set base color from Background Color . |
![]() |
Gradient Mask Fade | Transition with gradient gray scaled texture. | ![]() |
Usage for Mask Gradient Fade
-
Download
UniFader.unitypackage
from releases page and import it. -
Create new GameObject and add UniFader component from
Add Component
in inspector. -
Change Fade Pattern to
MaskGradientFade
-
Set
Transition Material
fromAssets/UniFader/Materials/UI_GradientMaskTransition.mat
. -
Set
Mask Texture
from andAssets/UniFader/Sample/Textures/SampleGradientMasks
.
-
Play!
Transition options
Easing
Edit easing from Fade Out Curve
and Fade In Curve
.
Fade Out In Mode (Gradient Mask Fade only)
Yoyo
Invert Yoyo
Repeat twice
Repeat invert twice
Tips
Used As Instance
If this is enabled, the fader will be singleton instance. It is referenced from UniFader.Instance
and it will be set DontDestroyOnLoad
.
Add fade pattern
You can add Fade Pattern by implementing IFadePattern
.
using MB.UniFader;
using UnityEngine;
using UnityEngine.UI;
public class TestFade : IFadePattern
{
[SerializeField] private int hoge;
[SerializeField] private Color fuga;
public void Initialize(Image targetImage) { }
public void ExecFade(float progress, bool fadeOut) { }
}
After that, you can select that pattern in Fade Pattern
in inspector.
Add callback
You can add callback from inspector (On Fade Out / In) or script. If you add callback for FadeOut, you can write as follows.
using System.Collections;
using UnityEngine;
using MB.UniFader;
public class FadeTest : MonoBehaviour
{
void Start()
{
UniFader.Instance.FadeOut(() =>
{
Debug.Log("FadeOut completed!");
});
}
}
License
- MIT
- © UTJ/UCL
Author
Gok