Game Development Reference
In-Depth Information
Adding particles to the animation
So that the particles are played at the beginning of the animation, we need to add an An-
imation event to the timeline. When the event is fired, it will call a custom function
against the object it is attached to.
Sadly, we still cannot call particle systems directly from the Animator Dope sheet, so we
have to work around this with these Animation events.
Before we can add the event, we first need to add the function and its corresponding code
of the particle system to the EnemyController script that the animator is working
from.
First, add a new variable to the top of the class to store a reference to the particle system:
private ParticleSystem bloodsplatterParticles;
Next, we will grab the reference to the particle system from the component added to the
game object the script is attached to in the Awake function:
void Awake()
{
bloodsplatterParticles =
Search WWH ::




Custom Search