- Home /
OnParticleTrigger runs every frame?
I'm having some difficulty understanding Particle System triggers. I want to have the "Inside" callback only execute when my Collider is inside the particle system.
My initial idea was just to throw a print statement into the OnParticleTrigger() function, but this seems to run the print statement every frame:
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
[ExecuteInEditMode]
public class ParticleTriggers : MonoBehaviour
{
ParticleSystem ps;
void OnEnable()
{
ps = GetComponent<ParticleSystem>();
}
void OnParticleTrigger()
{
print ("inside"); // why does this run every frame?
}
}
I then thought maybe there's a problem with my collider and particle system and they're always colliding, but this isn't the case. If I change the color of the affected particles (see this page) then the particles only change colors once I'm inside the particle system.
So am I misunderstanding OnParticleTrigger? Does it run every frame? This seems to defeat the purpose of calling this feature a "callback".
Your answer
Follow this Question
Related Questions
UpdateParticle system should not happen on disabled GO 4 Answers
prefab loading via resources forced to inactive 2 Answers
Change particle render material randomly. 1 Answer
Flame Thrower Particle System problem with movement 0 Answers
Particle System shows shurkins when particles are stopped 0 Answers