My Dash VFX

I am posting from the future, but only just thought to make my own dash effect. It looks pretty neat with or without post-processing.

ezgif.com-crop(2)

For this to work the way I wanted to, I had to make a 2-sided material with an albedo of the player’s sprite (I had to resize it to a square 64x64), additive rendering mode, and emission. I also needed to access the main module of the particle system:

[SerializeField] private ParticleSystem dashParticleSystem;
private ParticleSystem.MainModule dashParticleSystemMain;
private void Start(){
    dashParticleSystemMain = dashParticleSystem.main;
}

This was so that I could flip the 3D start rotation as the player sprite flips:

        dashParticleSystemMain.startRotationY=Mathf.PI;

I’ve left out some details, but if anyone would like me to elaborate, feel free to reach out to me.

3 Likes

Hey! I would be interested in hearing a bit more about how you did this. For the particlesystem.main, are you using a particle system material or just a particle system? I was fallowing along and saw that the particlesystem.main was in the material but I was having some difficulty finding it in the particle system. Any more information you could provide would be awesome! I love the affect and want to try to make it work for my project!

I am not changing anything about the material in my code, nor am I referencing the material itself.

Side note: It’s an interesting idea but I don’t think changing the material properties in runtime would work for me because every particle with the same material would be affected at the same time, and I do not desire this. I want each after-shadow to spawn at the same orientation of the player and then stay at that orientation.

So to clarify, my variable “dashParticleSystem” is definitely an object of type “ParticleSystem”.

In my particle system prefab, I have a custom script (so the game object has both a particle system components and a c# script component). In the inspector of the custom script, I drag the same game object into the “dashParticleSystem” field. An alternative method would be to use “getComponent”. After getting a reference to the particle system itself, I then grab a reference to the main module. For some reason which is not entirely clear to me, the particle system modules have to be referenced as variables before they can be modified.

The final step which I have omitted is to hook up some logic that checks if the player isFacingLeft each frame and modifies the startRotation accordingly.

I hope that answered your question. I’m currently on holiday but if you would like me to elaborate further, I can do so in about five days or so.

Privacy & Terms