Rigidbody2D.velocity Problems.

So i’m making 2D Pong Game and i have an error.

" An instance of type ‘UnityEngine.Rigidbody2D’ is required to access non static member ‘velocity’. "

#pragma strict

var moveup : KeyCode;
var movedown : KeyCode;
var speed : float = 10;

function Update () 
{
    if (Input.GetKey(moveup))
    {
        Rigidbody2D.velocity.y = speed;                  
    }
    else if (Input.GetKey(movedown))
    {
        Rigidbody2D.velocity.y = speed *-1;                       
    }

    else 
    {
        Rigidbody2D.velocity.y = 0;
    }


}

Fixed that. All you need is to replace “Rigidbody2D.velocity.y = speed;” to GetComponent.Rigidbody2D().velocity.y = speed; (Add “>” before and after Rigidbody2D).