Hi,
I have an array of materials and when I assign one to a plane it’s displayed black. This happens only in devices, not on web. The materials are power of 2, and if I assign it in the editor it shows up well in the devices.
Here’s my code:
var tarjetas : Material[];
function Start ()
{
transform.Find("Front").renderer.material = tarjetas[0];
}
It should be noted that this script is applied to an empty GameObject that has two planes in it (Front and Back);
Any help will be much appreciated. Thanks!
As a starting point, try an alternate shader. I know I've had issues with even simple shaders working in one environment and not in others.
– robertbuYou will often see shader errors appearing in the device log if the shader would not compile on the device
– whydoidoitThere were no shader errors in the log. Only if I assign them in code they appear black.
– GoodgabThe log on the device? And have you tried a different shader to rule out the textures etc. Pretty sure my iOS shaders go black if they don't compile - but Unity always puts a log in the XCode console explaining why.
– whydoidoitYou might want to try have something with that shader on it actually in the scene - there might be a problem where it gets optimised out of the build if nothing appears to be using it.
– whydoidoit