Why do we need the if statement in the Playhiteffect method? Couldn’t you just have the code that’s in the brackets.
void PlayHitEffect()
{
if (hitEffect != null)
{
ParticleSystem instance = Instantiate(hitEffect, transform.position, Quaternion.identity);
Destroy(instance.gameObject, instance.main.duration + instance.main.startLifetime.constantMax);
}
}