I downloaded the WaterFX pack from the asset store and I need it to start raining after I hit a trigger. However, It needs to be delayed about 5 seconds after the trigger. I searched this site and only found very old answers that don’t work with the new version. Unless I missed something. Any ideas on triggering this? I know how to make a trigger and have this script so far
You don’t necessarily need a script on the particle system.
I don’t see in your example code you posted any starting/run/whatever of a particle system, just an if statement and a yield and return after 5 seconds.
You also didn’t display any curly braces that would the ‘then’ part of the if statement, with the code you showed, if the player.tag was “Player” then it would just wait for 5 seconds, and continue on after that line, but again, no mention of starting anything else.
Your code could be structured in such a way that.
This is fake code, it’s not meant to work but to provide some ideas.
var someParticleSystemObject : ofWhateverType;
function Start(){
someParticleSystemObject = // use something like GetComponent or FindGameObjectsWithTag to get a reference to the particle system.
}
function OnTriggerEnter(player:Collider){
if (player.tag == "Player")
{
yield WaitForSecond(5);
// Do whatever you do to execute the particle system.
}
}