Drawing and rotating an object in the corner of a camera's view?

I’m trying to draw an object so that it will always appear in the top right corner of a camera’s view, no matter what direction the camera is actually pointing. While the object shouldn’t move from this position, I want it to be able to rotate to match the current orientation of the camera.

This is actually the same feature that Unity already has in its scene editor:


I just want to know how to implement it into an actual game.

Any suggestions on how I could accomplish this?

You can add the object as a child to the camera at the correct position, then use this.