After messing around with material and shader, I succeeded in rendering the player with grayscale after his/her death.
These were the steps, I did:
- Create a new Material
- Set the material Shader to Sprites/Default
- Apply the material to the player sprite
- Create a new Shader
- Copy/Paste the Shader code from here https://forum.unity.com/threads/sprite-shader-with-greyscale.222693/, thank you RChrispy
- in PlayerMovement change the material shader
GetComponent<SpriteRenderer>().material.shader = Shader.Find("Sprites/GrayScale");