I'm trying to get a bit of code working that if a condition is met, it sets a material to a gameobject and if it is not met, it sets a different material. The code I have at the moment is:
var materials : Material[];
public static var Coloured : boolean;
function Update () {
if (Coloured)
renderer.material = Material[1];
else
renderer.material = Material[0];
}
However, this returns the error 'Type System.Type does not support slicing'. Can anyone point me in the right direction? (I have set the materials in the inspector).