Using Timers to Toggle Particle Color


AUTHOR: Charley Weaver

One of the challenges I faced this week was the alternating of particle color in the camouflage pickup in C++. Why do this in the first place? We wanted a VFX and/or SFX associated with attempting to pick up the camouflage pickup when the camouflage meter was full. This effect would indicate to the player that the pickup is unable to be retrieved at that time and give a subtle reminder that the camouflage skill was now available to use. 

In order to accomplish this feat, I needed three things: 

1. The ability to change the particle instance color.

2. A timer to allow for toggling of the color for a short period of time.

3. A Boolean for if the color has changed to prevent continuous cycling of color change. 

See below for how I accomplished this using the three above. 


Using the timer allowed the color change to temporarily occur as the ChangeParticleColor() function was called yet again to toggle the color right back to blue. Likewise, the particle instance parameter index 5 was just the vector I needed to change the color from Blue (FVector(0, 0, 1)) to Red (FVector(1, 0, 0)). The Boolean changed from false to true prevents the function from being called more than twice: first by the OnBeginOverlap() function and second by the ChangeParticleColor() function. 

See results below:

Leave a comment

Log in with itch.io to leave a comment.