Skip to content

Usage Guide

Fade out, load, fade in

csharp
using Carrot.Cameras.Transitions;

[SerializeField] private ScreenTransition screen; // material + a "fade to black" definition assigned

async Awaitable ChangeScene(SceneRef next)
{
    await screen.PlayIn();        // fade to black (eased, duration from the definition)
    await loader.LoadAsync(next);
    await screen.PlayOut();       // fade back up
}

Held transition = static split / picture-in-picture

A transition frozen at a fixed progress is a composition. With Mode = ToSource and Source set to a second camera's RenderTexture:

csharp
screen.Hold(0.5f);   // left half = world, right half = the other camera — comic "talking heads"
// sweep it to slide the divide:
await screen.Play(0.5f, durationMs: 250); // open the panel
// ... radio chatter happens ...
await screen.PlayOut();                   // close it

Swap the definition's Ramp for an iris/dissolve mask and the same hold becomes a porthole / vignette.

As a sequence step

The driver is the sequencable surface — a cutscene just awaits it:

csharp
await screen.Play(1f, 300);          // iris out
await camera.MoveTo(vantagePoint);   // (another sequencable)
await screen.Play(0f, 300);          // iris in on the new framing

Observers can react without driving it:

csharp
ScreenTransition.Completed.Add(t => Debug.Log($"transition done at {t.Progress}"));

Authoring looks

A TransitionDefinition (right-click → Create → Carrot → Cameras → Transition Definition):

  • Fade to black: Shape = Fade, Mode = ToColor, Color = black.
  • Iris wipe: Shape = Iris, Softness ~0.1.
  • Custom dissolve: leave Shape, assign a grayscale Ramp texture — it overrides Shape (darker pixels reveal first).
  • Split / PiP: Mode = ToSource, assign a RenderTexture as Source; a left/right Ramp gives the divide, then Hold(0.5).

Carrot