Cannot bake an object with multiple materials

I was testing baking on game objects to export, but I’ve run into a problem. I’ve set up a basic model with 3 materials.
Here’s the render:

When I try to lightmap/bake the sun lamp to a material (through the node editor as usual), the whole model turns gray, even when one material is selected.