UniFader is a transition helper components for Unity.
Unity 2019.3 or higher.
- 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.
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. |
-
Download
UniFader.unitypackage
from releases page and import it. -
Create new GameObject and add UniFader component from
Add Component
in inspector. -
Set
Transition Material
fromAssets/UniFader/Materials/UI_GradientMaskTransition.mat
. -
Set
Mask Texture
from andAssets/UniFader/Sample/Textures/SampleGradientMasks
.
-
Play!
Edit easing from Fade Out Curve
and Fade In Curve
.
Yoyo
Invert Yoyo
Repeat twice
Repeat invert twice
If this is enabled, the fader will be singleton instance. It is referenced from UniFader.Instance
and it will be set DontDestroyOnLoad
.
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.
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!");
});
}
}
- MIT
- © UTJ/UCL
Gok