How can I copy a sprite renderer from one GameObject to another?

I’m making a 2D game and my player has a move where they leave a series of after images behind them. I want to be able to set the SpriteRenderer of the instantiated after image object at run time as a copy of the player object’s SpriteRenderer. This is mainly because I have a few variations of the player object, with different sprites for each, and sometimes the draw mode is simple, and other times it’s sliced.

As far as I know, there isn’t any sort of SpriteRenderer constructor where you can pass in another SpriteRenderer to copy. I think you’ll just have to manually copy the properties that you need.

For example:

private void CreateAfterImage()
{
    SpriteRenderer playerSprite = GetComponent<SpriteRenderer>();
    GameObject afterImage = Instantiate(prefab, transform.position, Quaternion.identity);
    SpriteRenderer afterImageSprite = afterImage.GetComponent<SpriteRenderer>();

    afterImageSprite.sprite = playerSprite.sprite;
    afterImageSprite.drawMode = playerSprite.drawMode;
    //etc
}