Shading black in build but not in Editor

I’ve a strange issue, I guess Shader related.
I know it did work already and it did break this week … let me explain:

In deployed builds I see Screenspace Overlay UIs but no camera rendererings (everything is black). Windows / Mac tested. No wait, it is rendering but everything is black! I’ve tested the rendering by setting the camera’s background to Solid Color (red) and et voila I see that in fact stuff is being rendered, but not shaded. It seems either all Shaders would have been set to Unlit black or in general there’s something off with the shaders.
I’m using a Skyboy which explains why the sky was black as well before I switched to Solid Color background.

On Friday the whole thing worked and rendered everything correctly. From Tuesday on (at least) I get this black shaded black screen. I can’t recall touching shaders or materials (nor does my change log say). I didn’t move shaders out of Resource folder. The shaders are loaded and assigned by code completely.

I’m out of ideas and tried aleardy a lot of what the Interweb suggested, but all where slightly not what I’m experiencing and thus no solution worked for me.

Has anybody experienced this issue and might have some calming words (that solve the issue)?

As summary I’d say this fits: ‘While in Editor everything seems to be ok, deployments lack of shading and any shading related render is rendered full black.’

UPDATE 1

I just checked in the Editor what material is used (to manually copy it into a test scene) and discovered that even if things do seem being rendered correctly inside the Editor the Inspector reveals that shading should be black …

alt text

Nevertheless the Game view and the Scene viewport show correct lighting and texture information.

UPDATE 2

I’ve placed this free Cartoon Car into the scene with static asset refs. So in general the Shaders aren’t broken. Just the ones applied by code.

alt text

UPDATE 3

So overriding the typical mat = new Material(Shader.Find("ShaderName")) with mat = matFallbackInstance would fix the issue (matFallbackInstance is a manually referenced material prefab). But the thing is, we need to be able to dynamically assign shaders. Otherwise it would make sense to assign shaders dynamically … right?

Maybe my D3D is done. Nope, even executing with -force-opengl the shaders stay black.

Deleting Library, obj and Temp … waiting for reimport is dealing with all the assets. Nope, didn’t fix it.

Rolled back on Unitypackages in which tiles of the environment reside. (had an older copy of them). Also no.

Went through all Rendering Paths and Quality settings. Deploying like I had 8 arms… none of the resulting builds where near a solution.

I’ve checked what Fallback is defined in the used shaders … Off, so none. I also tried the “Diffuse” shader as a fallback but it didn’t fix it. I guess the shader itself isn’t the problem (and I’m pretty sure about this, since it worked already for years) and thus not falling back.
Leaving me with this questions behind

  • What causes materials to render Unlit Black only?
  • Why is creation different from Editor to StandAlonePlayer (both Windows)? And what is different?
  • Why is the Scene / Game viewport showing ‘correct’ rendering while the Inspector states that the material is black (see first screenshot).

Found it. It was a rim texture generated during runtime. Strangely enough that in Editor it worked but my guess is and it fits that it has to do with timing.
In Editor the rim textures where assigned in time, in the build not … so thas the difference between Editor / SA execution.

Weren’t the shader nor the material internals at all.