How to do it...

To use sprite sheets for particles animation, follow these steps:

  1. Import the sprite sheet texture into Unity. Its size should be a power of 2. The animation should be rendered from left to right and from top to bottom in equal tiles (128 × 128, 256 × 256, or similar).
  2. Set it as a normal Texture (not a Sprite) and check the Alpha Is Transparency option.
  3. Create a new Material and name it Explosion.
  4. Set the Shader to ParticlesAlpha Blended (you can also use Additive or Additive Soft).
  5. Drag and drop the texture into the Particle Texture slot in the Material.
  6. Create an empty game object in the scene and name it AnimatedExplosion.
  7. Add a Particle System component to it.
  8. Drag and drop the Explosion material into the Renderer | Material slot.
  9. Check the Texture Sheet Animation option and unfold it.
  10. Set the Tile's X and Y fields according to your exported sprite sheet. In our example, the sheet has 8 tiles in X and 4 in Y, as shown in the following screenshot:
Texture Sheet Animation settings
  1. Adjust the Start Lifetime of the particles to match the frame rate of your exported sprite sheet animation. If your exported animation lasts 1 second, then the Start Lifetime of a particle should be also equal to 1 second.
  2. Adjust the other settings of the particle system to your liking. In this example, those settings are as follows: 
    • Start Lifetime: 1
    • Looping: True
    • Start Speed: 0
    • Start Size: 5
    • EmissionRate: 1
    • ShapeShape: Sphere
    • ShapeRadius: 4
  3. Play the game or simulate the particle system to see the effect.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.147.77