简体   繁体   中英

So my bullet prefab shows trail when dragged into the scene But not when I play it

So when in scene mode the bullet prefab shows the trails but when I hit the play button it doesn't show any trails whatsoever. I am trying to make a top down shooter with unity. I am new to this, please help much appreciated.

While playing it doesn't show the trail

When in scene mode it shows

Trail renderer settings

You can set the order of the trail renderer in Trail Renderer > Additional Settings > Order in Layer .

For an older version of Unity layer ordering variables are not exposed in the inspector. You can write a custom script that sets the sorting layer / order.

public class RendererSortingLayer : MonoBehaviour
{
    public string sortingLayerName;
    public int sortingOrder;

    void Awake()
    {
        Renderer renderer = this.GetComponent<Renderer>();
        renderer.sortingLayerName = sortingLayerName;
        renderer.sortingOrder = sortingOrder;
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM