[SALE] Screen Fader 1.6 - Screen transitions with effects in one line of code

Screen Fader

Main features:

  • Screen transitions with different effects
  • Fading of GameObjects
  • Fading of UI elements
  • Load Levels with fading effect
  • Makes any fading with one line of code
  • Chain calls, like: Fader.Instance.FadeIn().Pause(10).FadeOut()
  • Easy to extend with own Actions and Coroutines
  • Dynamic change of fading color
  • Compatible with Unity 5
  • Friendly Price

Get it here:

Play demo

This easy-to-use script will allow you to fade in or out your screen with only one line of code, so all you need is to write:

Fader.Instance.FadeIn();

Very easy, but on the other hand, you will get infinite possibilities. You can fade the screen, UI elements or objects, change the speed and colors, join methods in chains, call Coroutines and your own actions. You can subscribe on events and get notifications when fading will be started or completed. Screen Fader also supports fluent interface, so you can make more readable code with chains of methods, for example:

Fader.Instance.FadeIn().Pause(10).FadeOut();

This script also support invoking of coroutines and any actions (it’s realy any actions that implement IAction or IParametrizedAction interface), so you can write such sequences:

Fader.Instance.FadeIn().StartCoroutine(this, PostMyScoreCoroutine()).FadeOut();
//or
Fader.Instance.FadeIn().StartAction(new MyMostLovelyAction(), parameter).FadeOut()

At the last version (1.3) was added LoadLevel method, and fading of game objects:

/// Load "Scene2", it's also possible to load level by its index
Fader.Instance.FadeIn().Pause().LoadLevel("Scene2").FadeOut(2);

/// Hide character
Fader.Instance.FadeIn(characterGameObject);

This works well on Free and Pro Unity, suitable for Web, Standalone, Android and iOS platform. And all this takes less then 50kb on your drive and costs less then your morning coffee.

So, the another features of Screen Fader are:

  • Easy-to-use, easy-to-write and easy-to-read what you wrote - it is just one line of code!
  • Powerfull sequences
  • Possibility to call coroutines
  • Possibility to make you own actions
  • All Screen Fader’s code gathered into couple of files, that takes only 10kb.
    …and some other cool features are coming soon…

What is more: you’ll get 2 extra scripts that will allow you to fade your screen with squares or stripes effect, and of course you can also setup their additional parameters, such as number of stripes or squares and direction of effect.

API Example of usage screenshots

API Help
Table of content

  • FadeIn
  • FadeOut
  • Pause
  • Flash
  • LoadLevel
  • SetColor
  • StartAction
  • StartCoroutine
  • StopAllFadings

FadeIn( time )
Fade-in screen in ā€˜time’ seconds. ā€˜time’ argument is optional, default value - 1.

Fader.Instance.FadeIn();
Fader.Instance.FadeIn( 3 ); /// Fade screen in in 3 seconds

FadeIn( GameObject, time )
FadeIn( UI.Element, time )
FadeIn( UI.Image, time )
Fade-in gameobject. GameObject’s material should support transparency. ā€˜time’ argument is optional, default value - 1.

/// Hide characterGO in 3 seconds
Fader.Instance.FadeIn( characterGO, 3 );
/// Change character’ hemlet
Fader.Instance.FadeIn( HemletOfWarion ).FadeOut( HemletOfKing );

FadeOut( time )
Fade screen out in ā€˜time’ seconds. ā€˜time’ argument is optional, default value - 1.

Fader.Instance.FadeOut();
Fader.Instance.FadeOut( 3 ); /// Fade screen out in 3 seconds

FadeOut( GameObject, time )
FadeOut( UI.Element, time )
FadeOut( UI.Image, time )
Fade gameobject out. GameObject’s material should support transparency. ā€˜time’ argument is optional, default value - 1.

/// Hide wall and show Enemy Boss character.
Fader.Instance.FadeOut( Wall ).FadeIn( EnemyBoss );

Pause( time )
Make pause in chain of fadings or actions.

Fader.Instance.FadeIn().Pause().FadeOut();  /// pause 1 second
Fader.Instance.FadeIn().Pause( 3 ).FadeOut(); /// pause 3 second

Flash( inTime, outTime )
Make flash - quick fade-in and fade-out. Arguments inTime and outTime are optional. Default values are inTime = 0.075, outTime = 0.15

Fader.Instance.Flash();
Fader.Instance.Flash( 0.1, 3 ); /// Quickly fade screen in and slowly out

LoadLevel( name )
Load new scene by its name

Fader.Instance.LoadLevel( "IntroScene" );
Fader.Instance.FadeIn().LoadLevel( "Scene-1" ).FadeOut();

LoadLevel( index )
Load new scene by its index

Fader.Instance.LoadLevel( 1 );
Fader.Instance.FadeIn().LoadLevel( 1 ).FadeOut();

SetColor( color )
Default color of fading is black, but this method allow changing of color at runtime.

Fader.Instance.SetColor( Color.white ).FadeIn().LoadLevel( 0 ).FadeOut();
Fader.Instance.SetColor( Color.red ).Flash(); /// Damage - red flash

StartAction( IAction )
Execute a custom action. Custom action is an instance of class implementing IAction interface. Here is an example:

HidePrincessAction action = new HidePrincessAction();
Fader.Instance.StartAction( action );

/// Hide princess while screen is faded, and then fade screen out.
Fader.Instance.FadeIn().StartAction( action ).FadeOut();

IAction interface, defines Execute() method that will be called and Completed property, that you should set to ā€˜true’ when action will completed:

public interface IAction
{
  bool Completed { get; set; }
  void Execute();
}

public interface HidePrincessAction: IAction
{
  public bool Completed { get; set; }
  public void Execute()
  {
  GameObject.Find("MarioPrincess").GetComponent<Renderer>().enabled = false;

/// It lets screen fader know that action is completed
/// and next action could started.
  this.Completed = true;
  }
}

StartAction( IParametrizedAction, object[ ] )
Execute a custom action that accept some parameters. Here, custom action is an instance of class implementing IParametrizedAction interface. Let’s improve our example:
ChangeCharacterAction param_action = new ChangeCharacterAction();

/// Hide Mario and show Princess
Fader.Instance.StartAction( param_action, "Mario", "Princess" );
/// Hide Princess and show Mario
Fader.Instance.StartAction( param_action, "Princess", "Mario" );

IParametrizedAction’s Execute() method can get any number of parameters. See the implementation of ChangeCharacterAction:

public interface ChangeCharacterAction: IParametrizedAction
{
  public bool Completed { get; set; }
  public void Execute( params object[] args )
  {
  GameObject.Find( args[0] ).GetComponent<Renderer>().enabled = false;
  GameObject.Find( args[1] ).GetComponent<Renderer>().enabled = true;

/// It lets screen fader know that action is completed
/// and next action can be started.
  this.Completed = true;
  }
}

StartCoroutine( MonoBehaviour, Coroutine )
Start coroutine method in series. Next fading tasks will be starter after coroutine finish. MonoBehaviour is an game object where coroutine ( IEnumerator method ) located. NOTE: This Conoutine’s methods have to have ā€˜yield break’ operator!

/// Show 'Game Over' for 5 sec and fade-in screen.
Fader.Instance.StartCoroutine( this, ShowGameOver() ).Pause( 5 ).FadeIn();

...

IEnumerator ShowGameOver()
{
  text.text = "Game Over";
  yield return new WaitForSeconds( 5 );
}

StartCoroutine( MonoBehaviour, methodName, methodParameter )
Start coroutine method in parallel and pass parameter to it. Next fading tasks will be starter right after coroutine was started.

/// Show 'You Game is Over, Mario' text for 5 sec and fade-in screen.
Fader.Instance.StartCoroutine( this, "ShowGameOver", "Mario" ).Pause( 5 ).FadeIn();

...

IEnumerator ShowText( string name )
{
  text.text = "You Game is Over, " + name;
  yield return new WaitForSeconds( 5 );
}

StopAllFadings()
Brakes all fadings immediately.

Fader.Instance.StopAllFadings();

Video tutorial:

Thank you!

is it possible to make a fade in/out for the children of a specific gameobj without fade in/out all the scene ?

1 Like

I’m not sure that I understand you correctly. Do you mean to fade-in/out gameobject - in other words to hide or show gameobject smoothly?

[UPDATE]
Yes, I’ve just released an update, and now it is possible.
Check out new demo and try (Object Fading button): http://patico.pro/Content/ScreenFader/Demo_1_3/ it also include a code samples, so you can see how to use it.

Hi Patico, sent you a email on issues couple of weeks ago, you have not replied.

Hi,Robin! Thanks for notifying me, I’ve just found your emails amongs the tons of spam messages. I will reply you today.

Hi, Robin
I’ve send you an e-mail.

Hi Patico, didn’t get your email. Where did u send it to?

Hi, I send it to ...@cyberversion.com, I hope it is your email.
Send again via PM on this site. Check out Notifications.

Hmm, Got your pm. but didn’t get your email. I don’t have any spam filters.

New version of Screen Fader now available on Asset Store.
Update unclude some new features:

  • LoadLevel() method (see screenshot bellow)
  • GameObjects fading (2D and 3D)
  • Changing fade color at runtime via SetColor() method

Check out new demo with code samples: http://patico.pro/Content/ScreenFader/Demo_1_3/

Some new features added in version 1.3:

Is there anyway to separate fading by camera or layer ?

Hi, to avoid misunderstanding, could you describe what do you mean by ā€œseparate by cameraā€ and ā€œseparate by layerā€?

For example i have 2 cameras: ui camera and scene camera and i want limit fading to only scene camera therefore ui is always visible and is not affected by fading.
.
Same goes to the layers if i want fade only this partical layer.

Well, understand you now. Unfortunately such features not implemented in current version. I’ll consider about possibility of adding them in the further releases, but I can’t promise it now.

Version 1.4.1 of Screen Fader now available on Asset Store.
Update unclude next new features:

  • Lines Effect
  • Image Effect - screen transition with image (could be transparent). In demonstration scene it used for making of damage flash.

Check out new demo with code samples here: DEMO

Hi Patico,

I’ve just purchased your ScreenFader Asset. It looks amazing and it’s exactly what i need. My problem is that I’m a beginner in unity and programming.

Can I use your asset in javascript?
Maybe you can give me a few examples.

I’d like to transition between scenes using the SquaredScreenFader.
Here’s my function to switch to the next scene:

function NextLevel () {
Application.LoadLevel(GameStart.level); // switch to the upcoming scene
}

Allthough I’ll try to learn c# I would love to use JavaScript in my first project.

best wishes

Edit: I would need this code in JS ā€œFader.Instance.FadeIn().Pause().LoadLevel(ā€œScene2ā€).FadeOut(2);ā€

Edit2: It seems that I have only access to the SquaredScreenFader with a c# script… maybe it doesn’t work with a JS-Script at all… :smile:

Edit3: After diving into Unity a couple of hours I was able to solve my problems and now the fader is running like a charm…

When accessing the classes (precompiled under the assetfolder/Plugins/) from within JavaScript you have to send arguments… example:
Fader.Instance.FadeIn().Pause().LoadLevel(ā€œScene2ā€).FadeOut(2); → this doesn’t run. Instead:
Fader.Instance.FadeIn(0).Pause(0).LoadLevel(ā€œScene2ā€).FadeOut(2); —> runs like hell! :wink:

After bringing this wonderful asset to life, i’m loving it… :slight_smile:

[NEW FEATURE DONE]
Updated to 1.5

Hi everybody, here is a good news, guys - just now Screen Fader 1.5 update was accepted by Unity Asset Store Team and became available here - https://www.assetstore.unity3d.com/en/#!/content/9526

This update includes some fixes for full compatibility with new Unity 5 API, and couple of minor changes eliminating annoing warning messages from output console.

Recomend to update : )

Can you explain me what are the benefits of your plugin against just using an alphablended quad in front of the camera?

Okay
there are a lot of them…

First of all you don’t need ā€œalphablended quadā€ at all. Forget about it and just type:

Fader.Instance.FadeIn();
  • another one, is possibility to combain calls in chains, like this:
Fader.Instance.FadeIn().Pause( 10 ).StartAction( YouCustomAction ).FadeOut();
  • also you can ā€œfade objectsā€ in the same way ( probably, you can meet some problems here when you will try to do the same with ā€œalphablended quadā€ ; ) ):
Fader.Instance.FadeIn( myCharacterGameObject ).StartAction( ChangeCharactersAction ).FadeOut( myNewCharacterGameObject );
  • or load levels:
Fader.Instance.LoadLevel( "IntroScene" ).FadeOut( 3 ).Pause( 10 ).FadeIn().LoadLevel( "Level-1" ).FadeOut();

and so on…
A lot of other cases described above, but i recommend just try a demo - here

And one more thing - there also some different fading effects, you also can see them in demo.