Movement and Speed issues

hello everyone !
i’m making a 2d games basicly 4 objects are supposed to float in the playfield with their speed increase over time i tried many scripts to get my movement as i wanted it to be but nothing seems to work i just want my objects to move and float in the playfield and bounce when the collide with each other or with the walls also so speed increase is not working so i need help please here is my script

using UnityEngine;


public class Movement : MonoBehaviour
{
//speed of the ball
public float speed = 3f;
public float intervale = 5f;
public float accel = 2f;
public double passedt ;
//the initial direction of the ball
private Vector2 spawnDir;

//ball’s components
Rigidbody2D rig2D;
// Use this for initialization
void Start()
{
//setting balls Rigidbody 2D
rig2D = this.gameObject.GetComponent<Rigidbody2D>();

//generating random number based on possible initial directions
int rand = Random.Range(1, 4);

//setting initial direction
if (rand == 1)
{
spawnDir = new Vector2(1, 1);
}
else if (rand == 2)
{
spawnDir = new Vector2(1, -1);
}
else if (rand == 3)
{
spawnDir = new Vector2(-1, -1);
}
else if (rand == 4)
{
spawnDir = new Vector2(-1, 1);
}

//moving ball in initial direction and adding speed
rig2D.velocity = (spawnDir * speed);

}


private void FixedUpdate()
{
passedt = double.Parse(Timer.secondes);
if (passedt == intervale)
{
speed += accel * Time.deltaTime;
Vector2 veloc = new Vector2(speed, 0);
rig2D.velocity = veloc;
intervale += 5;
Debug.Log("test");
}
}

}

I think what is going on is that you have this line in the wrong spot.

 rig2D.velocity = veloc;

I would put everything in “FixedUpdate” into a normal “Update” function. However leave the “rig2D.velocity = veloc;” in the FixedUpdate.

As for making the object’s bouncy, just make a physics material in the Unity Editor and attach it to the object’s collider.
Hope it helped.

-Ronnie