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".
The documentation for OnParticleTrigger says it "is called when any particles in a particle system meet the conditions in the trigger module."
I have the same issue. The whole thing feels janky af. Hopefully some one can answer this.
Still happening as of Unity 2018.3.0f2. It even happens for me if I mark all events as 'Ignore' and delete the assigned collider.
Same issue here, callback every frame even when all events set to Ignore. Any workarounds?
Having the very same issue, really hoping I was doing something wrong and not just a bug, most probably?
Answer by aureliomv · Apr 03, 2018 at 01:26 AM
I'm experiencing the same issue. Maybe a bug with Unity? You could use "ps.GetTriggerParticles(ParticleSystemTriggerEventType.Inside, enter);" as a work around, but I agree, it would defeat the purpose of being a callback.
Your answer

Follow this Question
Related Questions
How to put an image on a particle system 0 Answers
Editing Positions of a Particle System (Sub Emitter) 0 Answers
Finding target position for particle system based shooting 0 Answers
Particles emited from bellow the cone base shell 2 Answers
How to make Particle System on when I throw grenades on ground after 5 second. 3 Answers