This stop-action animator system will allow you to play any animation when a particle collides/dies.
Yes, this works on PlayerLocal. Be responsible.
Video Demonstration/How To Use:
https://youtu.be/fdUZ-cpGNZ8 Copy of ReadMe:
How to Use
Move the "PulseAnimator" object so that the flashing particle collides with the "On" cube.
This will trigger the animation, enabling the cube with a sound.
To reset the system for the next use and disable the cube, Toggle the "Reset" animator on the "Reset" GameObject.
This animator should turn itself off after the reset is complete.
For use, both the flashing particle system and the collider that kills it must be jointed to the avatar where you need them. (or IKed:
https://youtu.be/0MgtpcQ5-Ew)
The actual system from "Reset" down can technically be anywhere.
So, how's this working anyway?
I'm abusing 2 things:
Stop-action on particle systems.
Mechanim animator resets.
Basically, 2017 particles now have a feature that allows you to perform an action when the last particle in the system dies. In this case, it disables the object the particle is on.
If we use an animator to keep the object with the particle on it enabled then it will disable from stop-action and immediately enable again.
Now, animators.
I went over this in my state-machine cycler video:
https://youtu.be/GHjWF4yflRU?t=50 Essentially, turning the object an animator is a part of to disabled and enabled again while the animator is still on will set its state to "Entry" which resets the animator from the beginning.
In this case, I'm using a stop-action triggered or "non-linear" animator to cause the animation to only play if the object is disabled and enabled again.
Here is exactly what happens in this system:
The "OnLogic" object immediately enters its suspend state, disabling its animator.
The reset, which is on by default, forces the animator on the "OnLogic" object to move passed suspend into its third state then turns itself off.
This disables the cube.
The "OnLogic" particle being emitted by the "EnableSample" emitter and dying immediately causes the "OnLogic" object to rapidly be disabled and enabled again.
This resets its animator to entry.
The "OnLogic" animator enters its first state.
This enables the cube.
The "OnLogic" animator enters its 2nd state.
This disables its animator, locking the state.
Since the reset animator is off, the "OnLogic" animator will not move passed it's suspend, effectively toggling the object.
The reset animator animates the "OnLogic" animator which forces it passed the suspend into the 3rd state.
This disables the cube, resetting the system.
Frankly, it's a lot to take in.
I don't expect most of you to understand it to be honest and that's ok.
This is here for the people that think they can and have the drive to learn something new.
Once you figure out how it's all happening there are a ton of possibilities now available to you.
I've spent a very long time developing this method, this is just the base logic to get you started.
There's some pretty complex working systems I've already made with this as a base.
Feel free to contact me with questions or suggestions on Discord: Rero#9097