To fully exploit the power of Magical Box, you should know about it's concept and how the different objects work together to render particles on screen.

Magical Box Objects

Particle System

This is the main object. All other objects are children of this object. Unlike Unity's Particlesystem a Magical Box Particlesystem does not define any particle properties. It's main purpose is to manage a pool of particles to be (re-)used by emitters and to handle Update() for all it's layers and emitters.

If you build effects for your game, it's best practise to bundle several or all effects in a single Particle System to minimize management overhead.


A layer is used to build and render a particle mesh, so each layer needs a material assigned to it. Think of it as the counterpart of Unity's ParticleRenderer, though it does more like dynamically building the texture atlas needed by it's material.

A Particlesystem may contain multiple layers. In most cases you don't need more than two layers (one using an additive shader and one using an alphablended shader).


Emitters are the objects spawning particles and defining their behaviour. Each emitter uses a single layer to render it's particles. Emitters can be nested at will, and interacting with an emitter will manipulate it's child emitters as well.


The working horse of Magical Box. Every emitter uses a set of parameters to alter it's particles. Size, Color, Speed, Texture Animation…each particle property will be processed by a parameter, including your own custom properties.


Anchors are simple objects you may want to use to ease integration in your game. Though you can nest emitters to act like an anchor (e.g. if you want to translate or rotate several emitters at once), you can add anchors to your gameobjects (player, obstacles etc.) to synchronize their transforms. As only Magical Box objects are shown in the MB editor window, you can add anchors to your game object to make them part of the Magical Box hierarchy. It sounds complicated at first but actually it isn't!

Anchors are also used to manage emitter pools. Say you've done a nice explosion emitter and want to use it in your game. Usually you have to instantiate this emitter when showing multiple explosions at once, but that's a bad idea performance wise. You could use an external pooling solution (SmartPool, PoolingManager etc…) to manage a pool of emitter-prefabs for you. Or you just parent your explosion to an anchor and let the anchor do all the nasty work for you. Just tell the anchor when you want an explosion, and it will be spawned for you…and yes, this means a pooling manager is included!

Rendering & Processing Order

Magical Box updates and renders particles using the following rules:

  • Emitters and layers are sorted by name within their hierarchy level.
  • Emitters process and add their particles to their layers in the order shown in the Magical Box Overview hierarchy
  • Emitters process their particles by creation order, updating the oldest particles first.
  • While in Unity's editor layers render their meshes in the order shown in the Magical Box Overview hiearchy.

If you need to fine control particle's updating/rendering order, use one or more of the following technique:

  • Name and nest emitters
  • When developing 2D fx, slightly alter an emitter's z position
  • Add additional layers and name them accordingly
Last modified: 2015/07/29 20:33 by Jake