2d ball bounce at same velocity

Hi guys.

I have a 2d ball and a wall with bounce physics on it…the ball doesnt have any gravity or mass attached to it and after giving it a nudge in the start method, it goes on to bounce from wall to wall, buuuut the problem i am having is that the velocity keeps increasing instead of staying constant…


the bounce physics material is set as bounce = 1, friction = 0… what can i do to fix this, my game really depends on the velocity remaining constant

You can set the velocity to whatever you want. You can do it in update, but would be more efficient to do it when you collide.

void OnCollisionEnter2D(Collision2D col)
{
rb.velocity=yourValue;
}