TrailRenderer not showing in 2D game.

EDIT:
If I rotate the camera in the 3D world I can see the Trail Rendering. So it looks like it is rendering but the polygons are perpendicular to the Camera. I thought the Trail should always face the camera. What am I doing wrong?

Original Question:

Hello, I have been trying to get this working for 2 days, so I’m getting a little desperate.

I want to add a Trail Renderer to a 2D game.

I have a simple 2D Sprite, with a simple movement script (change transform.position on update)

I attached a TrailRenderer Component to it and a Material:

If I hit on Play, the trail shows in the #Scene but not in the Game Window.
After some researches, I found out that this might be a SortingLayer problem.

So I create a C# Script to fix this and attached it to my sprite:

public string sortLayerName = "Effects";
public int sortLayerOrder = 11;

    void Start () {

        TrailRenderer trail = GetComponent<TrailRenderer>();
        trail.sortingLayerName = sortLayerName;
        trail.sortingOrder = sortLayerOrder;
    }

And here are my sorting layers:

81168-sorting-layers.png

As you can see, “Effects” should be on top.

Howeber no matter what I try, the Trail will NOT show in the game (but it shows correctly in the #Scene window)

Another thing I tried is to add the trail rendered to an empty object, and add the object as a child to the sprite. Same issue. The trail only appears in the #scene window.

Any help is greatly appreciated. Thank you!

hi, change your TrailMaterial to Sprites-default or Default-particle . you can find it in default materials of unity