Checked with version: 2017.3


Difficulty: Beginner

This component is used to spawn VFX prefabs from a pool. Deactivate them and return them to the pool after a lifetime has expired.

VFXController is an Asset in the Project folder (inside the Resources folder) which allows you to list all the visual effects the game uses. It creates a pool of instances of those visual effects to be used, moving the cost of instantiating the VFX prefab at the beginning of the game instead of every time they are used.

Scripts like the PlayerController or the StateMachineBehaviour TriggerVFX then trigger those visual effects by name.

Like the Audio Player, it also allows you to define overrides per tile. For example, you can set an override to the visual effect used for each footstep depending on which surface the footstep lands on.

In the case of the VFXController shipped with this project, you can see an example of that on the DustPuff VFX that uses an override for when the Player walks on stone.

The overriding tile is given by the script that triggers the visual effect (e.g. footstep pass the current surface, or a bullet hitting a surface passes whichever tile is in that surface).

It is possible to setup the override tile on non-tilemap GameObjects; refer to the sound documentation Sounds.txt for how to setup which override a GameObject should correspond to.

Related tutorials