zligg
zligg

Reputation: 49

Trail renderer always black?

For some reason the 2D trail renderer stays black no matter what I do to change the color. Any idea why?

enter image description here

Upvotes: 1

Views: 4037

Answers (3)

Jerry Switalski
Jerry Switalski

Reputation: 2720

The answer is very easy. You use Mobile/Diffuse shader that does not accept Main Color to multiply the texture. You need shader that has Main Color. You can use my (it is varation of Mobile/Diffuse but with Main Color)

    Shader "Mobile/Diffuse Color" {
    Properties {
        // Adds Color field we can modify
        _Color ("Main Color", Color) = (1, 1, 1, 1)        
        _MainTex ("Base (RGB)", 2D) = "white" {}
    }

    SubShader {
        Tags { "RenderType"="Opaque" }
        LOD 100

        Pass {
            Lighting Off

            SetTexture [_MainTex] { 
                // Sets our color as the 'constant' variable
                constantColor [_Color]

                // Multiplies color (in constant) with texture
                combine constant * texture
            } 
        }
    }

    Fallback "Mobile/VertexLit"
}

Also you should use some texture, it can be 2x2 resolution white pixels. It will color the textures with exactly the same color as choosen in Trail Renderer.

Upvotes: 1

David Dimalanta
David Dimalanta

Reputation: 548

Try changing different material (regardless the no. of materials you added) and change the color to anything at least it's bright. Make sure you set the alpha to 255 to maintain visibility

Upvotes: 0

AntiHeadshot
AntiHeadshot

Reputation: 1130

As far as I know, the tail renderer needs a sprite shader. You are using a standard shader so lighting will be calculated wrong.

Upvotes: 3

Related Questions