❔ Question About ParticleEffects in Unity/C#

So right now, im only a couple weeks into C#/GameDev. Im working on a tiny little project to try to get an understanding of where things go and when. The game is a basic 2D rocket league type deal with simple stuff like boosting and driving ofc. Im currently trying to add a particle effect WHILE boosting. I thought maybe a simple... if (!boostEffect.isPlaying && Input.GetKey(KeyCode.Space)) { speed = boostSpeed; boostEffect.Play(); } else if (boostEffect.isPlaying && Input.GetKeyUp(KeyCode.Space)) { speed = resetSpeed; boostEffect.Stop(); } would work buttt...my 1st issue was the delay in animation which i managed to get working. Now my issue is getting it to STOP immediatly after letting up on space bar. If i use looping, i mean itll just keep going, if i turn it to no looping, then duration becomes the issue. Ive tried setting duration to 0 but it sets it to 0.05 and it being even that, causes the animation not to play at all. So my question is, for a "While holding a button" type particl effect, is this just completely wrong? Any tips or pointers on how to write it correctly for such an instance? P.S - If you happen to know a good udemy course perfect for getting a good grasp on C#(preferably gamedev related) i would love to know it. Thanks!
1 Reply
Accord
Accordβ€’17mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.