Rocket FX only play once

Hey everyone,
I’ve run into a strange issue with my particle system…

Repro Steps (As seen in the attached video):

  1. Start the game
  2. Press “space” to apply thrust
  3. Note - pressing space triggers the rocket particle FX, and releasing space stops them.
  4. Crash and lose the game
  5. When the game restarts, repeat step 2.
  6. Observe: pressing space does not trigger the rocket FX anymore.
  7. Restart the game entirely and repeat steps 1 and 2.
  8. Observe: pressing space still doesn’t trigger the rocket FX.

At the beginning of the video, I open the Rocketship prefab and confirm all three particle systems are attached as children and linked to the appropriate Serialized Field.

I’m not sure what the issue might be, but I’m also unfamiliar with Unity 2019’s changes to prefabs…

My code is written exactly like Ben’s, except I used a different name for my FX, which I declare at the beginning of the class as:

[SerializeField] ParticleSystem rocketFX;

>    private void RespondToThrustInput()
>     {
>         if (Input.GetKey(KeyCode.Space))
>         {
>             ApplyThrust();
>         }
>         else
>         {
>             audioSource.Stop();
>             rocketFX.Stop();
>         }
>     }
>     private void ApplyThrust()
>     {
>         rigidBody.AddRelativeForce(Vector3.up * mainThrust);
>         if (!audioSource.isPlaying)
>         {
>             audioSource.PlayOneShot(rocketSFX);
>         }
>         rocketFX.Play();
>     }


Please try the following in ApplyThrust():

if (!rocketFX.isPlaying)

Maybe the particle system restarts whenever the Play method gets called.

This worked! Thank you!

You’re welcome. :slight_smile:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms