About 'Stop Particle Emission In C#'!

In this video (objectives)…

  1. Refactor our gun enabling code.
  2. Find the particle system emission module.
  3. Stop bullet stream disappearing when we cease fire.

After watching (learning outcomes)…

Turn a particle system emission on and off in C#.

(Unique Video Reference: 41_AA_CU2)

We would love to know…

  • What you found good about this lecture?
  • What we could do better?

Remember that you can reply to this topic, or create a new topic. The easiest way to create a new topic is to follow the link in Resources. That way the topic will…

  • Be in the correct forum (for the course).
  • Be in the right sub-forum (for the section)
  • Have the correct lecture tag.

Enjoy your stay in our thriving community!

I Really enjoyed (for the most part) learning via this Argon Assault course. It enhanced my knowledge of C# somewhat, and enhanced my knowledge of Unity a lot. I like your spiral training approach. I have to give 100% to Ben’s teaching style - it’s like he gets what I may struggle with and takes time to meticulously detail what I (the student) need to learn.

I can see that Rick also knows what he is doing, and I have learned a lot from Rick as well. But I felt that Rick was, with good intention (that did not quite work), tried to get as much across to us as possible, but some of it, for me at least, went to fast and was not detailed enough…It seemed to me that it was pitched at folks who knew more about the Unity interface than I did. Buttons were clicked, or mouse was clicked or certain keyboard shortcuts were done, that had me watching 10 seconds of video, several times to try figure out what was just done. The Unity interface stuff for me was done to fast.

None the less I give this course 5/5 for the energy put in, and because it did achieve all objectives.

In the lecture you mention that the loop will pick up the Death FX because it’s iterating over all the children GameObjects. If it’s possible to overwrite the audio or put some text on screen to correct this in case anyone is confused, because it’s actually a SerializeField array on the player ship that consists only of the gun objects, and therefore would not / could not pick up other unrelated objects when enumerating through them.

2 Likes

Good catch. “guns” is defined at runtime and should never pick up the third item.

Small optimization. If you change the type for guns to ParticleSystem, it will store that reference instead of the GameObject so that GetComponent does not have to be called every frame:

[SerializeField] ParticleSystem[] guns;

foreach (ParticleSystem gun in guns) {
            var em = gun.emission;
            em.enabled = isActive;
        }
1 Like

Privacy & Terms