How do I change the attribute of a cube?

I’d like to make one side of the cube black and the other white.
Can I do this via GameObject?

There’s no way to change the way materials are applied to the default cube. You’ll have to make a cube in your modelling application and either apply materials to difference sides or use UV mapping to specify which parts of it are which colour.

Thanks Neil!

Why does:

var colorStart = Color.red;

Result in an error:

'red' is not a member of 'Color'.

This is straight from the manual…

Also, is it a good idea to simply apply a material to a
plane, change the color attribute of the plane as needed, and then mount the plane to a cube?

I’m trying to understand the best way to dynamically change the colors of a object with different surfaces (as opposed to a single surface like a sphere).

If your script or any script in your project is named the same as a Unity class, it will cause problems like that. It happens all the time with GUI. Solution: change the script’s name.

You can, but if there are going to be any decent number of these things it will be very slow because each face wold be a new mesh (new mesh=new draw calls, draw calls=terrible for performance… watch joachim’s optimization presentation from unite).
I think the best way to do what you’re looking for would to use the mesh interface’s Mesh.colors using a custom mesh - you could get it to work by putting together Unity-built-in-planes and the Combine Children script, and figuring out which vertex is on which face by checking its normal. (The Unity-built-in-cube wouldn’t work because each vertex is part of more than one face)

…Someone else may have a simpler idea.

Thanks StarManta, that was it!