Particle Effect for Glitch Garden Lesson not working

I have watched and read a lot of tutorials and I still cannot get my particle effect to instantiate when it hits the lizard as per the lecture. It doesn’t show behind or in front of the camera. I have tried playing with so many things in the settings - please see on the picture the latest attempt. When I drag an instance of the particle effect directly to the screen, it will show, but not when it is linked to a lizard.

I am using unity 2019.3.3f1

This is the code I currently have on that health script:

public class Health : MonoBehaviour
{
    [SerializeField] float health = 100f;
    [SerializeField] GameObject deathVFX;

    public void DealDamage(float damage)
    {
        health -= damage;
        if (health <= 0)
        {
            Destroy(gameObject);
        }
    }


    private void TriggerDeathVFX()
    {
        if (!deathVFX) { return; }
        GameObject deathVFXObject = Instantiate(deathVFX, transform.position, transform.rotation);
        Destroy(deathVFXObject, 1f);
    }
}


Hi,

Welcome to our community! :slight_smile:

Is the z-position of the camera set to z = -10, the background to z = 10, and the rest to z = 0?

Just put it to those , background was on 0. No change. Still doesn’t show :confused:

Would the world camera need a fix?

I don’t know if it will fix your problem but there is definitely an issue in the Canvas component. Do assign the camera to the field.

Did. Nothing changed though. So at lost at what’s wrong with this particle effect

Could you please upload your project to GitHub without the Temp and Library folder and share a link to the public repository here? I’d like to take a look into this.

Here is a tutorial video by Brackeys:

Hi Nina,

Here’s the project link : https://github.com/sbowl001/unity_fromUdemy2d . Thanks for the help!

Closing due to inactivity.
If this is still an ongoing problem please make a new thread or message a moderator to unlock the topic.

Hi Stephanie,

I’m sorry for the late reply. I’ve now taken a look at your project. The particle system does not appear because TriggerDeathVFX does not get called anywhere in the Health instance. This should fix it:

    public void DealDamage(float damage)
    {
        health -= damage;
        if (health <= 0)
        {
            TriggerDeathVFX(); // <------- This!
            Destroy(gameObject);
        }
    }

If the particle system still does not appear, increase the duration in the Explosion VFX prefab.

Did this fix it? :slight_smile:


See also:

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

Privacy & Terms