This is less of a problem and more of me trying to understand something. In “How To Trigger Particles”, the challenge asks us to make code that plays particle effects.
My solution was, in CollisionHandler.cs, to add the following lines:
In the Class:
[SerializeField] ParticleSystem crashParticles;
[SerializeField] ParticleSystem successParticles;
ParticleSystem particlesystem;
In Start():
particlesystem = GetComponent();
In StartCrashSequence:
particlesystem.Play(crashParticles);
In StartSuccessSequence:
particlesystem.Play(successParticles);
The actual answer, though, was to use
successParticles.Play();
crashParticles.Play();
The following lines were completely unnecessary:
ParticleSystem particlesystem;
particlesystem = GetComponent();
This feels weird to me because it doesn’t work like the audio ones. Why does it work this way instead?