- Home /
Why does my shader make geometry disappear when scene reloads?
I created a new shader that uses vertex color alpha, a tint color, and a single alpha texture. I can assign this shader to my object, and it behaves just like I want it to. Then, I save my scene, exit Unity, relaunch Unity. Now any object assigned to this shader appears completely transparent.
I know it hasn't moved, because I can select it and see its wireframe. If I assign a different shader to the material, I can see the object again. I then assigning my custom shader again and it looks fine. But, if I exit Unity and restart, everything is gone again.
Here is the code for my shader. I'm wondering if turning lighting off has something to do with it?
------ See shader below --------
Shader "My Shaders/Alpha Vertex Alpha" {
Properties
{
_Color ("Color Tint", Color) = (1,1,1,1)
_MainTex ("SelfIllum Color (RGB) Alpha (A)", 2D) = "white"
}
Category
{
Lighting Off
ZWrite Off
Cull Back
Blend SrcAlpha OneMinusSrcAlpha
Tags
{
Queue=Transparent
}
BindChannels
{
Bind "Color", Color // bind vertex color to 'primary' color
}
SubShader
{
Pass
{
SetTexture [_MainTex]
{
constantColor[_Color]
Combine Texture * constant, Texture * Primary
}
}
}
}
FallBack "Transparent/Diffuse"
}
Answer by Jessy · May 20, 2010 at 09:57 PM
You need
Bind "vertex", vertex
if you manually bind anything. That has to be in there, or you won't see anything.
You also need
Bind "texcoord", texcoord
or the texture won't have an effect.
Your answer
Follow this Question
Related Questions
(Shader Graph) Output resolution/ setting resolution of the main preview window 0 Answers
How can I disable masked object shadow with DepthMask shader 1 Answer
Scripts not updating the material's shader properties 1 Answer
PBR Standard Shader not Working Project Wide in Unity 5.3 0 Answers
Shader wants texture coordinates... 1 Answer