Particle effect not showing up

Hello,

I decided to create a simple vfx for when the player collides with the exit sign. The problem is that the particle effect is appearing behind the background. I tried adjusting the Z-axis and sorting layer of the effect but I can not get it to move to in front of the background.
I do have the particle system connecting to the exit sign in the prefab and to the one in the scene
Here is what I see:

Here is my code:
public class LevelExit : MonoBehaviour
{
[SerializeField] float waitToLoad = 2f;

[Header("VFX")]
[SerializeField] GameObject levelCompleteVFX;

private void OnTriggerEnter2D(Collider2D other)
{
    LevelCompleteVFX();
    StartCoroutine(LoadNextLevel());
}

IEnumerator LoadNextLevel()
{
    yield return new WaitForSeconds(waitToLoad);
    var currentSceneIndex = SceneManager.GetActiveScene().buildIndex;
    SceneManager.LoadScene(currentSceneIndex + 1);
}

private void LevelCompleteVFX()
{
    if (!levelCompleteVFX) { return; }
    GameObject levelVFXObject = Instantiate(levelCompleteVFX, transform.position, transform.rotation);
    Destroy(levelVFXObject, 5f);
}

}

1 Like

Handling particles in 2D can be a little tricky.

Create a new material, left click - Create - Material:

Once you’ve created it, set the new material rendering mode to Sprite/Default:

Now go to your particle system, go to the Renderer settings and set the Order in Layer to something bigger than the background’s layer, don’t forget to use the new material you created in the Renderer settings also.

Then you’ll be able see the particles. Hope this helps!

1 Like

Thank you so much for your help!

1 Like

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

Privacy & Terms