How to make a gameobject move behind another gameobject?

Creating a 2d game, using the ortho cam. I have three gameobjects. All of them have about four to five sprite children named Face, eyes etc. Each children was sorted under the sorting layer named “Piece”. To illustrate:

CharacterOne
   Face (Sorting Layer: Piece) (Order in Layer: 1)
   Eyes (Sorting Layer: Piece) (Order in Layer: 2) 
   Mouth (Sorting Layer: Piece) (Order in Layer: 2) 

CharacterTwo
   Face (Sorting Layer: Piece) (Order in Layer: 1)
   Eyes (Sorting Layer: Piece) (Order in Layer: 2) 
   Mouth (Sorting Layer: Piece) (Order in Layer: 2) 

Now when one character collides with another collider, one of them should go behind the other character. How should I do this? I tried changing the z position and the camera to perspective but it does not work. I tried attaching a sprite to the character gameobjects, and assigning a sorting layer for the character gameobjects, but still nothing.

I think what you are looking for is Sorting Layers:

http://unity3d.com/learn/tutorials/modules/beginner/2d/sorting-layers

You could assign each character to a different sorting layer. I believe that you can also change them on the fly. The video above does a good job explaining them. So just get all the items (head, shoulders, knees, toes, etc) and get them rendering in the right layers to make it look “right”. Then just add that whole object to its own Sorting Layer (or maybe you have all NPC’s on one layer cause they never “touch” or overlap, idk, just speculating).

Anyway, the long and sort of it is that Sorting layers aren’t bound to the Z axis, but rather are an independent rendering layer system. This should solve your issue, but you may end up with lots of layers. Be smart about it, and only use 2 or three when needed, or things can get out of hand very fast.

Your other option is to use only the Z axis. Let’s say you have a floating head (2 of them) with Head, eyes, mouth. Without using some kind of sorting layer, you will have to mod the Z position of EACH feature something like this

Head 1
Head Z1
EYes Z2
Mouth Z3

Head2
Head Z4
Eyes Z5
Mouth Z6

So ALL the FEATURES of Head1 render BEHIND all the features of Head2. Just like using too many sorting layers, this can get out of hand REALLY REALLY REALLY fast! I would just use sorting layers

Hope That Helps!

Adam