Using C# to change the layer order of sprites?

I’m setting up my game to look like both Earthbound and Final Fantasy. All is well so far, but I may have run into an issue with my sprites.

When my camera changes to the side view (for the purpose of selecting moves), some monsters on the screen will be obscured by their allies, like a deck of cards.

Is there a way that I can have unity tell which character is selected, and move them in in the layer to have the selected monsters clearly visible when selected?

Yes. To control the sprite order through scripts, you’ll need to get the SpriteRenderer:
Assuming the script is on the enemy in question, use this to get it:

SpriteRenderer sprRen = GetComponent<SpriteRenderer> ();

So, once you’ve gotten the SpriteRenderer, you can get or set where you want the sprite to be in the layer with sprRen.sortingOrder. Sprites with negative values here appear “on top” of everything else, and positive values make them look farther back.