I am trying to get a light baked texture to work with a detail texture overlay -- no such animal in the standard assets, but I found something that seems perfect on the Wiki : Code (csharp): Shader "Baked Lighting/Detail Texture" { Properties { _MainTex ("Base (RGB)", 2D) = "white" {} _Detail ("Detail (RGB)", 2D) = "gray" {} } Category { // Bind per-vertex color for use BindChannels { Bind "Color", color Bind "Vertex", vertex Bind "TexCoord", texcoord } // Two texture cards: main and detail texture SubShader { Pass { SetTexture [_MainTex] { Combine texture * primary } SetTexture [_Detail] { Combine previous * texture DOUBLE, previous } } } // Single texture cards: only main texture SubShader { Pass { SetTexture [_MainTex] { Combine texture * primary } } } } } Except it doesn't work when I try to build a shader using this code. The shader appears as "Default" in the shader list and no params are exposed. Hmm. So I tried to build some of the other shaders on the Wiki, some work, some, same problem. Is this because I only have an indie license? Or am I doing something wrong? I doubled checked that no funky characters were getting into pasted source, and that I used the correct extension, etc. Beyond that I'm stumped! Tia, -- Bo
What errors are printed into the Unity console? (at the bottom of the screen, clicking on the red icon opens the full console)
none, but when I try to run it with the boogered up shader attached to something, I get the red X without an error message(!)
Ok, how are you creating the shader? It should go like this: 1. Assets -> Create -> Shader 2. Double click the created shader file in Project view (by default it's named "New Shader") 3. Paste the text, save. There should be no errors at this point. 4. Now in some of your materials, you select the shader from the popup.
That's exactly how I am doing it. It just doesn't work! Shader comes up "Default" in the list, parameters are not exposed, and it doesn't work. Thanks for your help...
... sending now -- I stripped out most of the extraneous material from the project folder, but verified that the problem still persists in the stripped down version. Thanks...
Just to follow up, in case others run into the same snafu: Problem turned out to be extraneous invisible characters that snuck into the code when copying and pasting from the web browser to my editor. Turning on "show invisibles" and doing a regex to hunt down the little nasties solved everything. Thanks Aras.