TransitionKit demo scene code. The basic idea is that the transitionWithDelegate method takes in an object that handles the transitions. This can be a standard class or a MonoBehaviour subclass (so that you can modify properties in the inspector) as in the third button. Transitions can change scenes if they want to or just obscure the current scene so you can reset/reconfigure things or move the camera somewhere else.
void OnGUI()
{
if( GUILayout.Button( "Fade to Scene" ) )
{
var scene = Application.loadedLevel == 0 ? 1 : 0;
TransitionKit.transitionWithDelegate( new FadeTransition( Color.black, 0.5f, 0.2f, scene ) );
}
if( GUILayout.Button( "Pixelate to Scene with Random Scale Effect" ) )
{
var scene = Application.loadedLevel == 0 ? 1 : 0;
var enumValues = System.Enum.GetValues( typeof( PixelateTransition.PixelateFinalScaleEffect ) );
var randomScaleEffect = (PixelateTransition.PixelateFinalScaleEffect)enumValues.GetValue( Random.Range( 0, enumValues.Length ) );
TransitionKit.transitionWithDelegate( new PixelateTransition( 0.5f, 0.2f, randomScaleEffect, scene ) );
}
if( GUILayout.Button( "Twirl via Component" ) )
{
GetComponent<TwirlTransition>().nextScene = Application.loadedLevel == 0 ? 1 : 0;
TransitionKit.transitionWithDelegate( GetComponent<TwirlTransition>() );
}
}