I just wanted to share a helpful tip instead of using the bounce material where your player bounces higher and higher every time. I know when I was following I didn’t want it to make my player go higher and higher because of the level design I had in my head. I wanted 1 constant height every bounce or “mushroom” would do.
Instead of the material, make a new script called Bounce(cleaner code this way imo)
Get rid of the Start and Update code in there and simply put the code below. Make sure to go back into Unity and on your player add the tag Player found in the screenshot below also.
{
[SerializeField] float bounce = 15f;
void OnCollisionEnter2D(Collision2D collision)
{
if (collision.gameObject.CompareTag("Player"))
{
collision.gameObject.GetComponent<Rigidbody2D>().AddForce(Vector2.up * bounce, ForceMode2D.Impulse);
}
}
}