Can't bake ID maps

Edited for readability, I type like a schizo. More edits to follow I’m sure.

I made a cube. I gave it 2 materials, surface type is diffuse BSDF. I assigned each material to 3 faces of the cube. They are Red and Green. In the Shading workspace, I added 1 Image Texture node for each material. Both are pointing to an image called ID_Map_Box, the colorspace is non-color.

In bake settings, bake type is diffuse, contributions for direct and indirect are shut off. color is ticked active.
Selected to Active is checked. In the material editor for both materials, I have the Image Texture node selected, and in the viewport, the object is in edit mode and all surfaces are selected.

Target is Image Textures. In Margin, type is adjacent faces and size is 1 px.

When I click bake it says No valid selected objects.

This is becoming extremely frustrating as I really want to make use of ID maps for the meshes I create for UE5, and the way I have my workflow structured hinges on this one stupid thing working out finally. It’s been days I’ve been trying to learn how to do this.

Hi, try this old thread; Cycles Bake - No valid objects selected

Edited because I’m dumb

I had to have Selected to Active off and I added a camera to my scene.

BUT I have a new problem. The only way I could get it to “work” was because somehow the Bake Type was switched to Normal. This did not produce the intended map.

Whenever I try to produce a map that will have the intended RGB channels (in a non-color space, intended) it spits out a blank image.

I’m not in front of the computer… but i think you need to have the image texture node in all materials, and bake without Selected to active.

As much good advice as there was in this thread, I found out the solution in my particular case. It was failing because I am making use of more than one material at a time, and had 2 Image Textures open (1 in each material).

To fix it, I made sure an Image Texture existed in only 1 material. I baked the ID map and, now, unfortunately, it only baked the data from the 1 material. For example, I baked the Red channel texture only.

Ok. Fine. I have to bake one channel at a time or it gets fussy at me. So, then I deleted the Image Texture from that the Red material, swich to the Green channel material, add an image texture, select the already baked image, shut off Clear Image option (so that it doesn’t remove the data from the first channel baking), and then baked the 2nd channel color, green, to the image. And voila!

Of course my case has to be so damn fussy.

Anyways, thanks everyone for your help. And remember, read the freaking manual! I was only able to come up w this solution cause I spent time reading the Render Baking page in the docs!