How do i make my player sprite change, when entering a powerup?

I am making a start 2d platformer, actually my first game i got the walking, jumping and collisions working
But now when i’ve got to make powerups i wondered how i make a player sprite change to another in a certain amount of time.

To change the sprite you need the SpriteRenderer, if your script is in the same game object as it, you can call.

GetComponent<SpriteRenderer>().sprite = /*The sprite you want.*/

For the time you can use Coroutines or Invoke.

Coroutine:

private IEnumerator ChangeSprite()
    {
        yield return new WaitForSeconds(/*Time*/);

        //Change sprite.
    }

You must call this way:

StartCoroutine(ChangeSprite());

And you need to add using System.Collections;

Invoke:

private void ChangeSprite()
    {
        //Change Sprite
    }

You must call like this: Invoke("ChangeSprite", /*Time*/);

For more info you can check:

or