---
title: "Play an explosion flipbook once in Unity"
description: "Play an explosion flipbook once in Unity: Looping off, one burst particle, Start Lifetime equal to the clip, Cycles 1, and Stop Action set to Destroy."
canonical: https://appliedmanifold.com/guides/unity-play-explosion-once/
site: "Applied Manifold: The spatial compute cloud for 3D reality"
---

1.  [Home](https://appliedmanifold.com/)
2.  [Guides](https://appliedmanifold.com/guides/)
3.  Play an explosion once

GUIDE // UNITY

# How to play an explosion flipbook once in Unity

Turn off Looping on your Particle System, emit a single particle from a burst at time zero, and set its Start Lifetime to the clip's length with Texture Sheet Animation Cycles at 1, so the frames run once from first to last. Set Stop Action to Destroy and the effect removes itself when it ends.

[Get Free API Key](https://console.appliedmanifold.com/sign-in?next=/api-keys) [See the examples →](https://appliedmanifold.com/docs/pyrofx/examples/)

-   Godot 4 Available
-   **Unity** Manual setup
-   Unreal Engine Manual setup
-   Roblox Studio Manual setup
-   three.js Available

A draft compile is from $0.05, and new accounts start with $5 of usage.

**FIREBALLFINAL**

![First frame of the fireball bake](/bakes/fireball/poster.webp)

Fireball, 9.4 x 13.4 m, compiled with Spatial Compiler. [Spec →](https://appliedmanifold.com/docs/pyrofx/examples/#ex-fireball)

01 // HOW TO

## Build a fireball prefab that plays once

The fireball is a fuel explosion that bursts from the ground and rolls upward. Its 64 frames span 4 s.

1.  In the main module, turn off Looping, set Duration and Start Lifetime to 4, Start Speed to 0 and Stop Action to Destroy. Leave Play On Awake on.
2.  In Emission, set Rate over Time to 0 and add one Burst at Time 0 with Count 1.
3.  In Texture Sheet Animation, set Tiles to 8 and 8, Time Mode to Lifetime and Cycles to 1.
4.  Open the Frame over Time curve and add keys from the frame times in `layout.json`: at each key, time divided by 4 s across and frame index divided by 64 up, because the curve runs from 0 to 1 over the particle's lifetime. The compile packs more frames into the first moments of the blast, and a linear curve would play those moments too slowly.
5.  In Renderer, raise Max Particle Size from its default of 0.5 to 2 or more. The value is a fraction of the screen, and a fireball filling the view gets clipped to half the screen otherwise.
6.  Drag the GameObject into your Project window to save it as a prefab, and spawn it from code where the blast happens.

ExplosionSpawner.cs

```
using UnityEngine;

public class ExplosionSpawner : MonoBehaviour
{
    public ParticleSystem fireballPrefab; // Looping off, Stop Action Destroy

    public void Explode(Vector3 position)
    {
        ParticleSystem blast = Instantiate(fireballPrefab, position, Quaternion.identity);
        blast.Play();
    }
}
```

02 // REAL OUTPUT

## A second one-shot for smaller hits

Impact is a shell hitting dry ground: a flash, thrown earth and a little smoke. Its frames span 3.2 s, so set Duration and Start Lifetime to 3.2 and shape its curve from its own `layout.json`.

**IMPACTFINAL**

![First frame of the impact bake](/bakes/impact/poster.webp)

Impact, 3.5 x 2.8 m, compiled with Spatial Compiler. [Spec →](https://appliedmanifold.com/docs/pyrofx/examples/#ex-impact)

03 // HOW IT ENDS

## Why the last frame needs no hold

A one-shot compile runs until the effect has faded, so frame 63 of the fireball is almost empty. Nothing hangs in the air when the particle dies, and Stop Action Destroy removes the GameObject once its last particle is gone.

Keep Start Frame at 0 for one-shots. A random start frame suits loops, but here it would start some blasts halfway through. For variety, ask your agent for the same explosion with a new seed and pick one of the prefabs at random.

04 // RELATED

## Related pages

-   [One-shot explosion Godot 4Build a GPUParticles3D explosion in Godot 4 that plays once and frees itself, by hand or from a wired fireball scene.](https://appliedmanifold.com/guides/godot-one-shot-explosion/)
-   [Play an explosion once Unreal EngineMake a Niagara emitter play an explosion flipbook a single time and clean itself up, with an optional hold on the last frame.](https://appliedmanifold.com/guides/unreal-explosion-play-once/)
-   [Loop a flipbook in Unity UnityKeep a fire or smoke flipbook looping in a Unity Particle System by matching particle lifetime to whole cycles of the clip.](https://appliedmanifold.com/guides/unity-loop-flipbook/)
-   [Unity fireball UnityA fireball that bursts from the ground and rolls upward in 3.7 seconds, played in Unity by hand today.](https://appliedmanifold.com/effects/unity-fireball/)
-   [Unity VFX UnityFire, smoke, explosion and dust effects in Unity: sprite sheets you set up by hand.](https://appliedmanifold.com/effects/unity-vfx/)
-   [Loop vs one-shotLooping effects repeat until stopped and one-shot effects play once and fade out, and each needs its own frames and settings.](https://appliedmanifold.com/learn/loop-vs-one-shot/)
-   [OutputsWith the default export, each view writes four sheets, `<view>_pos.png`, `_neg.png`, `_colour.png` and `_aux.png`, plus `layout.json`, two still previews, the animated `preview_anim.png` and `bake_report.json`. Sheets are 8 x 8 tiles of 256 px by default.](https://appliedmanifold.com/docs/pyrofx/outputs/)

[All pages in Guides →](https://appliedmanifold.com/guides/)

[← Loop a flipbook in Unity](https://appliedmanifold.com/guides/unity-loop-flipbook/)[Random start frame →](https://appliedmanifold.com/guides/unity-random-start-frame/)

05 // FAQ

## Unity one-shot explosion questions

[All questions →](https://appliedmanifold.com/faq/)

**README.UNITY\_PLAY\_EXPLOSION\_ONCE**

### How do I play an explosion flipbook once in Unity instead of looping it?

Turn off Looping, emit one particle in a burst at time zero and set Cycles to 1 with Time Mode on Lifetime so the frames play once.

### How do I trigger an explosion particle system from code in Unity?

Instantiate the explosion prefab at the hit point and call Play or call Play on an existing Particle System. Set Stop Action to Destroy for automatic cleanup.

### How do I fade a fire or explosion flipbook in and out in Unity?

Turn on Color over Lifetime and set alpha keys on its gradient. A one shot compile already fades at its end, so it rarely needs a fade out.

### Can the Unity particle system play a precomputed explosion?

Yes. One particle with Texture Sheet Animation plays the entire fireball sheet and a second Particle System can add debris or smoke on top.

## Compile your first effect

You pay per compile and see the price before it runs. New accounts start with $5 of usage.

[Get Free API Key](https://console.appliedmanifold.com/sign-in?next=/api-keys) [Outputs →](https://appliedmanifold.com/docs/pyrofx/outputs/)

[All effects, guides and explainers →](https://appliedmanifold.com/effects/)
