Game Development Reference
In-Depth Information
_isRemoveLight = true;
GameObject.Destroy(_light);
}
}
}
void KillObject () {
ParticleSystem[] fireExplosions =
GetComponentsInChildren<ParticleSystem>();
for (int i = 0; i < fireExplosions.Length; ++i) {
if (fireExplosions[i] != null) {
fireExplosions[i].Stop();
fireExplosions[i].loop = false;
}
}
GameObject.Destroy(gameObject);
}
}
9. Then, go back to Unity and add the AutoDestroyParticle script to the Ex-
plosion object in Hierarchy . We will also create the prefab of the Explosion ob-
ject by dragging it to the Resources/Prefabs folder in the Project view. Re-
move the Explosion object from our Hierarchy view by right-clicking on this
and then choosing Delete . Now, we have got our Explosion particle.
10. Now we need to create our rocket prefab by going to the Resources/FBX/
Rocket folder in the Project view and drag the rocket prefab object to the
Hierarchy view.
11. Then, we will create FireTrail , which gets attached to our rocket. Let's go to
GameObject | Create Other | Particle System and name it FireTrail . We
need to drag it inside our rocket object, as shown in the following screenshot:
12. Go to the Inspector view of FireTrail and set it as follows:
Transform
Search WWH ::




Custom Search