-
Notifications
You must be signed in to change notification settings - Fork 65
Description
Hello.
I ran into the following problem:
My object is created in realtime, and i cant configure it through the inspector in advance. In fact, I can not even copy my object in prefab, since its mesh is created at runtime.
So i need to change the parameters using the code. I rummaged through the script for the editor (SpriteShaderGUI) and took a couple of functions from there.
As a result, my configuration code looks like this:
SetBlendMode(material, eBlendMode.StandardAlpha);
material.SetTexture("_BumpMap", GameObject.Find("TestObject").GetComponent<Res>().normalMap);
material.SetFloat("_ShadowAlphaCutoff", 0.635f);
material.SetFloat("_Cutoff", 0.6f);
material.SetFloat("_ZWrite", 1.0f);
SetMaterialKeywords(material);
As a result, everything is perfect in the editor. The shader is configured and i can safely work, but in the standalone build for Windows the parameters seem to be not applied and the object itself becomes very dark.
Perhaps this is due to the fact that I do not include the Pixel Lit shader in Graphics-> Always Included Shaders, but I throw it in ShaderVariants, since if i throw it in Always Included Shaders, then I get this madness:
