How do I create a constant velocity for a ball?

I’m currently trying to make a Pong game and I need to give the ball a constant velocity, I’m going to make it so it starts moving left in the X Axis so that it hits the players paddle first and then I hope that Unity’s physics engine will do the rest. Although I will have to adapt it so it bounces off the paddle instead of just grinding to a hault etc. However I can’t seem to give the ball a constant velocity for some reason. Here is the code:

#pragma strict

var v = new Vector3(0.0f, 0.0f, 0.0f);
var speed = 10.0f;

function Start () {
    GetComponent.<Rigidbody>().velocity = v;
    var movement = new Vector3(-1.0f, 0.0f, 0.0f);
    v =  speed * movement;
}

function Update()
{
    
}

function OnCollisionEnter(c : Collision) {
        if (c.collider.name == "Player" || c.collider.name == "Opponent")
            v.x = -v.x;
        else if (c.collider.name == "Wall")
            v.z = -v.z;
  }

Vector3 is a struct, not a class. As such, it is a value type, and is not referenced. In general terms, it works the same like a float does. You can assign it, but if you modify the original variable, nothing else will happen.

In your case, you need to modify Rigidbody.velocity again. Or just use a force and let the Rigidbody do its thing.