Is it possible to make an object not receive shadows?

Added on by Gustav Olsson.

First of all, shaders that don't write to the depth buffer (transparent shaders among others) will not receive shadows.

Even though there is no checkbox that controls whether a game object receives shadows or not, you can use multiple cameras to selectively shadow the scene. In one of my games, I render all the static geometry and shadows using the first camera, then the dynamic game objects using the second camera (which doesn't clear the display buffer). This way, only the static geometry will receive shadows and there will be no self-shadowing on dynamic objects. The 2 cameras are parented to the same game object so that I can control the view without having to change 2 game objects each time.

Here are the settings I use for each camera:
Main camera: Culling Mask: Everything except the "Dynamic" layer; Depth: -1;
Dynamic camera: Clear flags: Don't clear; Culling Mask: "Dynamic" layer only; Depth: 0;

Because shadows are rendered in the "Default" layer, dynamic game objects will not receive shadows. Note that while the self-shadowing is gone in the game view, it is still present in the editor scene view since it only uses one camera. Also note that while dynamic game objects do not receive shadows in this example, they can still act as shadow casters!

The toolkit lets you choose which layer the shadows are rendered in as well, in case you need to use more complex camera setups.