Is there a reason this shader wont work in a web browser?

Shader "Cube" {
    Properties {
        _Color ("Main Color", COLOR) = (1,1,1,1)
	}
	SubShader {
        Pass { Color [_Color] }
    }
}

I have 6 different materials whose shaders i swap out with this one when they double click the surface.

It switches fine in the editor but in a web browser (FF in this case) the color is always grey and not the color of the material it is attached to.

One additional question: Is there any reason to believe the above shader would not work on the iPhone?

Thanks!

L

Ok

I have done a bit more digging and come to the conclusion it is not the shader code.

Its whenever i change the material’s shader in code that it doesnt seem to work. The shader doesnt matter as I have assigned the shader i switch to to the default shader.

Anyone else seen this behavior?

Are you by any chance getting your shader reference from code by using Shader.Find (and not using a drag’n’drop reference)? If that is the case, be sure to put your shader files in a folder called Resources. It is mentioned in the scripting reference for Shader.Find.

As for the why: If you didn’t assign it anywhere, it won’t be part of the build so you can’t use it.
The content of the resource folder is always part of the build, independent if it is used anywhere through editor assignements or not.

You guys nailed it. I put my shader in a resources folder and it works properly now.

Thanks a ton!

Any reason that shader I included above wont work on the iPhone? I haven’t tried it yet I just want to see if there is an obvious reason it wouldn’t.

L

It should work on iPhone.