
The dice at the bottom were dragged into the scene manually, the dice at the top were spawned and re-tinted via code (to the same values that the prefab has by default).
Why is lightning being ignored?
For reference, I’m using default diffuse shaders.
Code:
//for ease of reading, the prefab switch statement has been omitted
inst = Instantiate(colorizedPrefabd10,pos,Quaternion.identity) as GameObject;
Renderer[] renders = inst.GetComponentsInChildren<Renderer>();
int i = 0;
foreach(Renderer r in renders) {
if(Size >= 8) {
switch(i) {
case 0:
r.material.color = numberColor;//numbers (transparent diffuse)
break;
case 1:
r.material.color = overlayColor;//overlay (transparent diffuse)
break;
case 2:
r.material.color = baseColor;//underlay (diffuse)
break;
default:
break;
}
}
}
//after this it's the d4 and d6 else-blocks, then adding random force and torque.
If I comment out the r.material.color lines, the lighting remains normal, but I don’t get the user-defined colors.
show me ur code
– MoorOops, sorry. Edited and added it. It's really nothing special. material.color = theNewColor; Commenting it out causes the problem to not occur, but also doesn't allow for the customization feature.
– Draco18sinst is a parent of some object ?
– MoorIt's a prefab. Contains 3 submeshes, which are all the same mesh just with different materials applied: [18585-prefab.png|18585]
– Draco18spls post ur full code
– Moor