Pass ForgeDocs Product page

API

Moments

Moments bundle shakes, flashes, numbers and transitions into one event. The Moment Track plays them from Timeline.

PassForgeMoment

Plays a moment made of Pass Forge effects without code: an explosion, a hit, a lightning strike, a scene change. Each step plays one effect with its own settings and delay. The moment plays from a UnityEvent or a script, or by itself when enabled, on a trigger or a collision, or at random intervals. It costs nothing while it waits. A moment that has started plays to the end even when its object is destroyed, so a projectile can carry its own explosion. Steps still waiting for their delay when the moment's scene unloads are dropped, so they never play in the next scene. PlayWithValue(float) plays it with a number its Damage Number steps show, such as the damage of a hit.

public sealed class PassForgeMoment : MonoBehaviour

Namespace PassForge.Effects, assembly PassForge.Runtime. Add Component: Pass Forge > Moment.

PassForgeMoment.momentName

Name scripts can play the moment by, through PlayNamed. Empty for none.

public string momentName { get; set; }

PassForgeMoment.steps

The steps, played together when the moment plays, each after its own delay.

public List<MomentStep> steps { get; }

PassForgeMoment.playOn

When the moment plays by itself.

public MomentPlayOn playOn { get; set; }

PassForgeMoment.triggerTag

Tag an object needs to start the moment on a trigger or a collision. Empty for any object.

public string triggerTag { get; set; }

PassForgeMoment.atContactPoint

On Trigger Enter and Collision Enter, plays where the other object touches this one rather than at this object's position: the first contact of a collision, or for a trigger the nearest point of this object's collider to the other.

public bool atContactPoint { get; set; }

PassForgeMoment.repeatInterval

Shortest and longest seconds between two plays when repeating.

public Vector2 repeatInterval { get; set; }

PassForgeMoment.cooldown

Seconds after a play during which the moment does not play again.

public float cooldown { get; set; }

PassForgeMoment.unscaledTime

Count delays and cooldowns in real time, so the moment keeps playing while the game is paused.

public bool unscaledTime { get; set; }

PassForgeMoment.onPlayed

Called each time the moment plays.

public UnityEvent onPlayed { get; }

PassForgeMoment.onFinished

Called when a play has run to its end, after its last step.

public UnityEvent onFinished { get; }

PassForgeMoment.chance

Chance the moment plays each time it is asked to, from 0 to 1.

public float chance { get; set; }

PassForgeMoment.maxPlays

How many times the moment plays at most. Zero has no limit.

public int maxPlays { get; set; }

PassForgeMoment.playCount

How many times the moment has played, toward Max Plays.

public int playCount { get; }

PassForgeMoment.range

Meters from the camera at which the screen steps fade to nothing: the shake, flashbang, screen look, rumble, phone vibration, field of view kick and lens blood steps. Zero plays them anywhere.

public float range { get; set; }

PassForgeMoment.blockedBy

Layers that keep the screen steps from playing when they stand between the camera and the moment.

public LayerMask blockedBy { get; set; }

PassForgeMoment.isPlaying

True while steps wait for their delay, a transition holds the screen covered, or a Screen Look step shows.

public bool isPlaying { get; }

PassForgeMoment.ResetPlayCount()

Lets a moment that reached Max Plays play again.

public void ResetPlayCount()

PassForgeMoment.WaitUntilFinished()

Waits in a coroutine until the moment's current play has run to its end.

public IEnumerator WaitUntilFinished()

PassForgeMoment.PlayNamed(string)

Plays every enabled moment with the given name, and returns how many played.

public static int PlayNamed(string momentName)

PassForgeMoment.PlayNamedAt(string, Vector3)

Plays every enabled moment with the given name with its shockwaves and flash lights at a world position, so one moment in the scene serves every object spawned from a prefab. Returns how many played.

public static int PlayNamedAt(string momentName, Vector3 position)

PassForgeMoment.PlayNamedAt(string, Transform, float)

Plays every enabled moment with the given name over an object, so one moment in the scene serves every enemy spawned from a prefab: its Damage Number steps show the value over the object, where quick hits add up, and its shockwaves and flash lights play at the object's position. Null plays each moment at its own object. Returns how many played.

public static int PlayNamedAt(string momentName, Transform target, float value)

PassForgeMoment.PlayNamedAt(string, Vector3, float)

Plays every enabled moment with the given name at a world position, such as where a shot hit: its Damage Number steps show the value there, and its shockwaves and flash lights play there. Numbers at a position never add up. Returns how many played.

public static int PlayNamedAt(string momentName, Vector3 position, float value)

PassForgeMoment.StopNamed(string)

Stops every enabled moment with the given name, as Stop does, without a reference to it: steps still waiting for their delay are dropped, repeating stops, a screen a Cover And Reveal step holds is uncovered once its cover is complete, and Screen Look steps fade out. Returns how many stopped.

public static int StopNamed(string momentName)

PassForgeMoment.Play()

Plays the moment at this object's position. A repeating moment stopped by Stop repeats again.

public void Play()

PassForgeMoment.PlayWithValue(float)

Plays the moment at this object, and its Damage Number steps show the value, such as the damage dealt. Pick it in a UnityEvent that sends a number, such as a health script's On Damaged. A value that is not a number shows nothing, with a warning, as PassForgeDamageNumbers.Spawn(Transform, float, DamageNumberKind) does.

public void PlayWithValue(float value)

PassForgeMoment.PlayWithValue(int)

Plays the moment at this object, and its Damage Number steps show the value. For UnityEvents that send whole numbers, which cannot pick the float version.

public void PlayWithValue(int value)

PassForgeMoment.PlayAt(Transform)

Plays the moment with its shockwaves and flash lights at another object's position, and its Damage Number steps over that object, so one moment serves every explosion. Null plays it at this object.

public void PlayAt(Transform point)

PassForgeMoment.PlayAt(Vector3)

Plays the moment with its shockwaves, flash lights and Damage Number steps at a world position.

public void PlayAt(Vector3 position)

PassForgeMoment.PlayAt(Transform, float)

Plays the moment over another object, with a value: its Damage Number steps show the value over the object, where quick hits add up, and its shockwaves and flash lights play at the object's position. One moment in the scene can serve every enemy this way. Null plays it at this object.

public void PlayAt(Transform target, float value)

PassForgeMoment.PlayAt(Vector3, float)

Plays the moment at a world position, where its Damage Number steps show the value. They never add up.

public void PlayAt(Vector3 position, float value)

PassForgeMoment.SetPlaying(bool)

Plays the moment when true and stops it when false, for a toggle or any UnityEvent with a bool. A Screen Look step with a duration of zero then stays on for as long as it is true.

public void SetPlaying(bool playing)

PassForgeMoment.Stop()

Drops the steps still waiting for their delay, stops repeating, uncovers a screen a Cover And Reveal step holds once its cover is complete, and fades out Screen Look steps. What its Canvas Group Fade, Audio Source Fade and Camera Zoom steps changed goes back over their Fade Out, unless kept with zero seconds, and its Light Flicker and Toggle Component steps put their light or component back at once. Shakes, waves and flashes already started finish on their own.

public void Stop()

PassForgeMomentTrack

A Timeline track whose clips play Pass Forge Moments when the playhead reaches them, in Play Mode.

public sealed class PassForgeMomentTrack : TrackAsset

Namespace PassForge.Timeline, assembly PassForge.Timeline. Timeline track: Pass Forge > Moment Track.

PassForgeMomentClip

A clip that plays a moment when the playhead reaches its start.

public sealed class PassForgeMomentClip : PlayableAsset, ITimelineClipAsset

Namespace PassForge.Timeline, assembly PassForge.Timeline. Timeline track: Play Moment.

PassForgeMomentClip.moment

The moment to play.

public ExposedReference<PassForgeMoment> moment

PassForgeMomentClip.momentName

Or the name of the moments to play, every enabled moment with this name.

public string momentName

MomentStep

One effect of a PassForgeMoment and its settings. Each effect reads the settings it needs and ignores the rest; For gives the ones an effect starts with.

public sealed class MomentStep

Namespace PassForge.Effects, assembly PassForge.Runtime.

MomentStep.effect

The effect this step plays.

public MomentEffect effect

MomentStep.delay

Seconds after the moment starts before this step plays.

public float delay

MomentStep.strength

How strong the effect is: shake amount, wave strength, light intensity or look strength. For a Damage Number, its size relative to the Damage Numbers look. For Lens Blood, how much blood lands, from 0 to 2. For a Phone Vibration, how hard the phone vibrates, from 0 to 1. For a Light Flicker, how far the light dims at its darkest, from 0 to 1.

public float strength

MomentStep.duration

Seconds the effect lasts. For a Screen Look, a Light Flicker and a Camera Zoom, zero keeps it on until the moment stops. For a Damage Number, zero shows it as long as the Damage Numbers effect says. For Lens Blood, zero lasts as long as the Lens Blood look's Seconds. For Show Route, zero lasts until the player arrives. A Phone Vibration's inspector shows it in milliseconds.

public float duration

MomentStep.radius

World units a shockwave, a flash light or a ping's ring on Fog of War Radars reaches. For Lens Blood, Within: meters from the player within which blood reaches the lens; zero reaches it at any distance.

public float radius

MomentStep.color

Color of a flash light, a highlight flash, a transition cover or a ping, or the blood of a Lens Blood step with its own color.

public Color color

MomentStep.transitionStyle

How a transition covers and uncovers the screen.

public TransitionStyle transitionStyle

MomentStep.hold

Seconds a Cover And Reveal transition keeps the screen covered.

public float hold

MomentStep.fadeIn

Seconds a Screen Look takes to appear.

public float fadeIn

MomentStep.fadeOut

Seconds a Screen Look takes to disappear.

public float fadeOut

MomentStep.look

The look a Screen Look step shows: a shipped screen preset or any Volume Profile with Pass Forge effects.

public VolumeProfile look

MomentStep.highlight

The highlight a Highlight Flash step flashes. Empty uses the one on this object or its children.

public PassForgeHighlight highlight

MomentStep.offset

Where a shockwave or a flash light appears, an aimed flashbang goes off, lens blood comes from, or a Show Route step leads, from the moment's position, turned with its object. For a Damage Number, where it starts from the top of the object it shows over, turned with that object.

public Vector3 offset

MomentStep.centerOnMoment

For a Screen Look, spreads the effects that start from a point on screen, such as Time Stop, Impact Frame, Speed Lines and Radial Blur, from where the moment plays rather than from the middle of the screen. For Lens Blood, Where It Is On Screen: lands the blood where the moment is on screen, kept off the middle; off lands it on the edge of the lens on the moment's side.

public bool centerOnMoment

MomentStep.pauseGame

For VHS Rewind, stops the game while the picture rewinds, so nothing moves unseen and the game carries on from where it was. The rewind only replays the picture; it never moves anything back.

public bool pauseGame

MomentStep.pitchVariation

How far a sound's pitch varies from play to play, so repeated sounds do not sound the same.

public float pitchVariation

MomentStep.sound

The sound a Play Sound step plays.

public AudioClip sound

MomentStep.particles

The particles a Play Particles step plays: a particle system in the scene, or a particle prefab that is spawned where the moment plays and removed when it is done.

public ParticleSystem particles

MomentStep.afterimage

The afterimage an Afterimage Burst step turns on. Empty uses the one on this object or its children.

public PassForgeAfterimage afterimage

MomentStep.dissolve

The object a Dissolve or Materialize step works on. Empty uses the one on this object or its children.

public PassForgeDissolve dissolve

MomentStep.moment

The moment a Play Another Moment step plays.

public PassForgeMoment moment

MomentStep.playName

For Play Another Moment, the name of the moments to play when no moment is picked: every enabled moment with this name plays where this one plays. Prefabs, which cannot point at an object in a scene, use this.

public string playName

MomentStep.amount

For a Camera FOV Kick, degrees added to the field of view, below zero to zoom in; for a Light Change, the intensity the light goes to; for a Material Property, the number the property goes to; for a Damage Number, the number shown when the moment was played without one, or always with usePlayedValue off. For a Canvas Group Fade, the alpha; for an Audio Source Fade, the volume; for a Rigidbody Impulse with awayFromMoment, how hard the push is; for a Light Flicker and a Transform Shake, how many times a second it changes; for a Camera Zoom, how many times closer the camera looks.

public float amount

MomentStep.punchKind

What a Transform Punch, Tween or Shake step moves: the position, the rotation or the scale.

public PunchKind punchKind

MomentStep.punch

How far a Transform Punch goes at first, or a Transform Shake at most: world units for a position, degrees around each axis for a rotation, or a share of the size for a scale. For a Rigidbody Impulse, the force, turned with this object: the spin around each axis for a torque.

public Vector3 punch

MomentStep.target

The object a Transform Punch step punches; empty punches this object. For Show Route, the object the route leads to, following it as it moves; empty leads to where the moment plays. For a Rigidbody Impulse, the object whose Rigidbody or Rigidbody 2D, on it or its parents, is pushed.

public Transform target

MomentStep.prefab

The prefab a Spawn Prefab step copies where the moment plays.

public GameObject prefab

MomentStep.activate

For Set Active and Toggle Component, whether the object or component is switched on rather than off.

public bool activate

MomentStep.snapshot

The snapshot an Audio Mixer Snapshot step moves its mixer to.

public UnityEngine.Audio.AudioMixerSnapshot snapshot

MomentStep.light

The light a Light Change step changes or a Light Flicker step flickers. Empty uses the one on this object or its children.

public Light light

MomentStep.changeColor

For a Light Change, whether the light's color changes to color too. For Lens Blood, Own Color: gives the blood color instead of the Lens Blood look's.

public bool changeColor

MomentStep.renderer

The object a Material Property step changes. Empty uses the renderer on this object or its children.

public Renderer renderer

MomentStep.propertyName

The material property a Material Property step changes, by its reference name, such as _BaseColor or _Smoothness. A color property goes to color, a number to amount.

public string propertyName

MomentStep.sceneName

The scene a Load Scene step loads, by name. It must be in the build's scene list.

public string sceneName

MomentStep.mask

The grayscale picture a transition with the Mask style sweeps by.

public Texture2D mask

MomentStep.onStep

The functions a Call Event step calls.

public UnityEvent onStep

MomentStep.numberKind

For a Damage Number, what kind of number shows, which sets its color and how it pops.

public DamageNumberKind numberKind

MomentStep.word

For a Damage Number, a word to show instead of a number, such as CRIT, MISS or BLOCKED: up to 12 letters A to Z, digits and + - . , % ! /. Empty shows a number.

public string word

MomentStep.usePlayedValue

For a Damage Number, shows the number the moment was played with, from PassForgeMoment.PlayWithValue(float) or a UnityEvent that sends a number. Off, or when the moment was played without one, it shows amount.

public bool usePlayedValue

MomentStep.revealOnRadar

For a Ping, shows the enemies within its radius on every Fog of War Radar for its seconds, even out of sight, like a sonar.

public bool revealOnRadar

MomentStep.pingShape

For a Ping, the sign in its middle, such as Enemy or Help. Steps saved before it existed read as Ring.

public PingShape pingShape

MomentStep.pingIcon

For a Ping with PingShape.Icon, the icon in its middle, tinted by its color.

public Texture2D pingIcon

MomentStep.aimed

For a Flashbang, goes off where the moment plays and blinds by where the main camera looks when it goes off: fully when looked at, a tenth as much from behind unless it is close by. Off, it whites out the whole screen whichever way the camera looks. Steps saved before it existed read as off.

public bool aimed

MomentStep.lookAwayHelps

For an aimed Flashbang, how much looking away protects the eyes, from 0 to 1.

public float lookAwayHelps

MomentStep.bloodSplat

For Lens Blood, how the blood lands on the lens.

public LensBloodSplat bloodSplat

MomentStep.canvasGroup

The Canvas Group a Canvas Group Fade step fades. Empty uses the one on this object or its children.

public CanvasGroup canvasGroup

MomentStep.audioSource

The Audio Source an Audio Source Fade step fades. Empty uses the one on this object or its children.

public AudioSource audioSource

MomentStep.changeVolume

For an Audio Source Fade, whether the volume goes to amount.

public bool changeVolume

MomentStep.changePitch

For an Audio Source Fade, whether the pitch goes to pitch.

public bool changePitch

MomentStep.pitch

For an Audio Source Fade with changePitch, the pitch the sound goes to: 0.5 is an octave down.

public float pitch

MomentStep.push

How a Rigidbody Impulse step pushes: a kick, the same kick whatever the mass, or a spin.

public MomentPush push

MomentStep.awayFromMoment

For a Rigidbody Impulse, pushes the body away from where the moment plays, such as where a hit struck, by amount, rather than along punch. Played at the body itself, it goes along this object's forward, or its right for a 2D body.

public bool awayFromMoment

MomentStep.component

The component a Toggle Component step switches on or off: a script, a renderer, a collider or a light, or anything else with an enabled box.

public Component component

MomentStep.camera

The camera a Camera Zoom step zooms. Empty zooms the main camera.

public Camera camera

MomentStep.curve

How a Canvas Group Fade, an Audio Source Fade or a Camera Zoom eases from where it was to its value, from 0 to 1 over its Fade In. Going back follows it the other way.

public AnimationCurve curve

MomentStep.For(MomentEffect)

A step for the effect, with the settings it starts with.

public static MomentStep For(MomentEffect effect)

MomentEffect

The effect one step of a PassForgeMoment plays.

public enum MomentEffect

Namespace PassForge.Effects, assembly PassForge.Runtime.

ValueMeaning
ScreenShakeShakes the picture, not the camera. See PassForgeScreenShake.
ShockwaveA refraction ring spreading from the moment's position. See PassForgeShockwaves.
FlashLightA brief light on the surfaces around the moment's position. See PassForgeFlashLights.
LightningLightning flickers over the scene. See PassForgeScreenFlash.Lightning.
FlashbangWhites the screen out. An aimed one goes off where the moment plays. See PassForgeScreenFlash.Flashbang(float, float).
TransitionCoverCovers the screen, for a scene change. See PassForgeTransition.Cover(TransitionStyle, float).
TransitionRevealUncovers the screen. See PassForgeTransition.Reveal.
TransitionCoverAndRevealCovers the screen, holds it and uncovers it again.
VhsRewindPlays the last moments backwards on tape. See PassForgeVhsRewind.
DatamoshKeyframeClears the smear of a Datamosh look. See PassForgeDatamosh.
ScreenLookShows a screen look for a while and fades it out.
HighlightFlashFlashes a highlighted object. See PassForgeHighlight.Flash(Color, float).
HitStopFreezes the game for a split second, the pause that makes a hit land.
SlowMotionSlows the game down for a while and eases it back.
PlaySoundPlays a sound.
PlayParticlesPlays a particle system, or spawns a particle prefab where the moment plays.
AfterimageBurstLeaves afterimages behind an object for a while. See PassForgeAfterimage.
DissolveDissolves an object away. See PassForgeDissolve.Dissolve(float).
MaterializeBrings a dissolved object back. See PassForgeDissolve.Materialize(float).
HighlightForSecondsShows an object's highlight for a while.
TransitionFromPicturePasses from the picture on screen to whatever the camera shows next. See PassForgeTransition.FromCurrentPicture.
PlayMomentPlays another moment where this one plays, to chain moments or share one.
RumbleRumbles gamepads and vibrates phones. See PassForgeRumble.
FieldOfViewKickWidens or narrows the main camera's view for a moment, a kick that sells speed and impact.
TransformPunchPunches an object's position, rotation or scale and lets it spring back.
LightChangeChanges a light's intensity, and its color if wanted, for a while or for good.
MaterialPropertyChanges a number or a color of an object's material for a while or for good.
LoadSceneCovers the screen, loads a scene behind the cover and uncovers it. See PassForgeTransition.LoadScene(string, TransitionStyle, float, Color).
CallEventCalls the functions picked in the step, for game logic at its point in the moment.
DamageDirectionShows that a hit came from where the moment plays. See PassForgeDamageIndicator.
LightningBoltFlashes a bolt of lightning from the sky down to where the moment plays. See PassForgeTether.Strike(Vector3, Vector3, float, Color, float).
DamageNumberShows a number or a short word where the moment plays, such as the damage it was played with. See PassForgeDamageNumbers and PassForgeMoment.PlayWithValue(float).
PingMarks where the moment plays on every Compass Bar and Fog of War Radar for a few seconds, for an alarm, an explosion or a call for help the player should turn toward. With MomentStep.revealOnRadar on it also shows the enemies within its ring on radars, like a sonar. See PassForgePings.
LensBloodLands blood on the camera lens from where the moment plays: where it is on screen, or on the edge of the lens on its side for the player being hit. Within keeps far hits off the lens; Range and Blocked By lessen it too. See PassForgeLensBlood.
ShowRouteLeads the player's PassForgeRoute to where the moment plays, or to the step's MomentStep.target, for its seconds, then back to the route's own destination; zero seconds lasts until the player arrives. Played over an object with no Offset, the route follows that object. With no route enabled it does nothing. See PassForgeRoute.ShowTo(Transform, float).
AnimatorSets a parameter of an Animator: fires a trigger, or sets a bool, a number or a whole number to MomentStep.amount, by the parameter's own kind, such as a Hit trigger.
SetActiveSwitches an object on or off, and back after the step's seconds when they are not zero.
SpawnPrefabMakes a copy of a prefab where the moment plays, such as debris or a coin, and removes it after the step's seconds when they are not zero.
ExplosionForcePushes the rigidbodies within the step's radius away from where the moment plays.
TransformTweenMoves, turns or grows an object by MomentStep.punch over the step's seconds, eased, and leaves it there, where a Transform Punch springs back.
BlinkMakes an object blink on and off for the step's seconds, such as while it cannot be hurt.
ColorFlashFlashes the color of a sprite or a UI graphic and lets it come back, such as a red hit flash.
AudioMixerSnapshotMoves an Audio Mixer to a snapshot over the step's Fade In, such as muffled sound under water.
CinemachineImpulseFires the Cinemachine Impulse Source on the step's object, or on this one, for projects whose cameras shake through Cinemachine.
FogChangeThickens or thins the scene's fog, and changes its color if wanted, for a while or for good.
PhoneVibrationVibrates the phone for the step's milliseconds at its strength, on Android and iOS. See PassForgeHaptics. Gamepads rumble with a Rumble step.
CanvasGroupFadeFades a UI Canvas Group to an alpha, for a while or for good, such as a panel that appears.
AudioSourceFadeFades an Audio Source's volume, its pitch or both to a value, for a while or for good, such as music that dips under a voice line.
RigidbodyImpulseKicks or spins one Rigidbody or Rigidbody 2D, along a force or away from where the moment plays.
LightFlickerMakes a light flicker at random for the step's seconds, or until the moment stops, then puts it back.
ToggleComponentSwitches a script, a renderer, a collider or a light on or off, and back after the step's seconds when they are not zero.
CameraZoomZooms a camera in or out by a factor, on its field of view or its orthographic size, and back, or holds it until the moment stops, such as a sniper scope.
TransformShakeShakes an object's position, rotation or scale at random for the step's seconds, dying down, where a Transform Punch springs along one line.

MomentPush

How a Rigidbody Impulse step pushes its body.

public enum MomentPush

Namespace PassForge.Effects, assembly PassForge.Runtime.

ValueMeaning
ImpulseA kick that heavier bodies feel less, as a hit or a jump pad gives.
VelocityChangeThe same kick whatever the body weighs, for a push that must always look the same.
TorqueA spin, around the axes of the step's force.

PunchKind

What a Transform Punch step moves.

public enum PunchKind

Namespace PassForge.Effects, assembly PassForge.Runtime.

ValueMeaning
PositionThe object's position, by an offset in world units.
RotationThe object's rotation, by degrees around its own axes.
ScaleThe object's scale, by a share of its size: 0.2 makes it a fifth bigger.

MomentPlayOn

When a PassForgeMoment plays by itself.

public enum MomentPlayOn

Namespace PassForge.Effects, assembly PassForge.Runtime.

ValueMeaning
ScriptOrEventOnly when PassForgeMoment.Play is called, from a UnityEvent or a script.
EnableEach time the component is enabled, including when the scene starts.
TriggerEnterWhen a collider enters this object's trigger collider.
CollisionEnterWhen something collides with this object.
RepeatAgain and again at random intervals while the component is enabled.