简体   繁体   English

所以我的子弹预制件在拖入场景时会显示轨迹但在我播放时不会

[英]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 .您可以在Trail Renderer > Additional Settings > Order in Layer轨迹渲染Trail Renderer > Additional Settings > Order in Layer

For an older version of Unity layer ordering variables are not exposed in the inspector.对于旧版本的 Unity 层排序变量不会在检查器中公开。 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;
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Unity2D:拖动预制件时播放实例化的预制件动画 - Unity2D: play instantiated prefab's animation when prefab is being dragged 为什么我的预制件的 position 在场景中掉落时会发生变化? - Why does the position of my prefab is changed when dropped in the scene? 在我的脚本中激活GameObject预制时未显示在场景中 - GameObject prefab is not showing in scene when activated in my script 运行游戏时,我的Prefab从脚本中消失了吗? - My Prefab disappears from script when I run the game? Unity-当场景中有多个预制件时,Raycast无法正常工作 - Unity - Raycast not working when more than one prefab on Scene 实例化的预制件没有按预期工作,但是当预制件放在现场时,一切都按预期运行 - Instantiated prefab is not working as expected but when the prefab is put on the scene then everything runs as expected 为什么当我按“播放”时游戏场景为空? - Why is the game scene empty when I press “play”? 如何让子弹预制件的精灵使用与我的武器相同的旋转? - How do I get a bullet prefab's sprite to use the same rotation as my weapon? 当我点击时鼠标轨迹传送 - Mouse trail is teleporting when i click 我如何在我刚刚实例化的预制组件中引用场景中的游戏 object? - How can I reference a game object on my scene in a prefab component I have just instantiated?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM