- Home /
Adjusting OnTriggerEnter2D() for OnParticleTrigger()
I have the following code for a damage script on bullets:
void OnTriggerEnter2D (Collider2D hitInfo)
{
enemy enemy = hitInfo.GetComponent<enemy>();
if (enemy!= null)
{
enemy.TakeDamage(damage);
Destroy(gameObject);
}
}
I'm trying to code a new weapon that uses particles instead of bullet prefabs, and the OnParticleTrigger function cannot have parameters, so this code won't work as-is. When I try, I get thrown this:
Script error: OnParticleTrigger
The message may not have any parameters.
What can I change or rewrite to get this to work?
Your answer
Follow this Question
Related Questions
How to keep particles moving past an obstacle after they have collided with it? 3 Answers
Particle System Working in game view but not working on Android build. 1 Answer
How to make OnParticleCollision affect multiple GameObject 1 Answer
Destroy particles based on bounds not lifetime 0 Answers
How to force a particle system emit from every vertex a mesh have? 3 Answers