How to layer sprites like you would in a paint program?

I’m having difficulties figuring out how to layer sprites in both code and the editor. I suppose I’m not sure which attribute to tamper with or how to set up the game objects.

I would be simulating a character holding a weapon and would like the weapon to be partially hidden when the character’s back is facing the viewer (B), and in front when the character is facing the viewer (A).

The weapon has to be a separate sprite so that I can perform animations with it.

See picture for clarification.

Change the sprite renderer’s sortingOrder property.

–Eric

I tried that but when I change the sorting layer it disappears entirely. I’m adding the weapon as a child of the character. Seems to have the same effect even when both are in the same hierarchy.

That’s assuming they’re on the same sorting layer (which they should be).

–Eric

They are both on Default, the problem still persist.

Edit

I restarted Unity and the issue has been resolved. It was a glitch apparently.