How to add forward velocity to a Rigidbody2D?

I can’t seem to figure out how to do this. I’ve checked the documentation, but it doesn’t really explain how to do it. This is the script I’m using right now:

var speed : int = 10;

function Update ()
{
rigidbody2D.AddForce(transform.forward * speed * Time.deltaTime);
}

It seems like it should be pretty simple. With this code, I’m not getting an error, but the object isn’t moving at all when it spawns. I’ve also tried to capitalize Rigidbody2D, 'cause I’m a little unclear on how it is supposed to be capitalized, but when I do that it gives me this error:

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

So I’m pretty sure the one without capitalization is correct. But it still isn’t moving? Could anybody help me understand why it isn’t moving and how I should go about fixing it? Thanks in advance for anybody’s help.

The likely problem is that you are using ‘transform.forward’. Rigidbody2D works on the XY plane, and typically you would be using a sprite for your projectile. So you want to use ‘transform.up’ or ‘transform.right’ depending on how you’ve setup your game and your sprite. In addition, ‘speed’ should be a float and likely have a larger value than ‘10’. For an object with a mass of 1.0, start with 500.

using UnityEngine;
using System.Collections;

public class PlayerController : MonoBehaviour {

	public float moveSpeed = 10;
	public float jumpForce = 100;
	public bool isGrounded = true;
	public float old_y;
	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
		if(transform.position.y <=old_y+0.1f && !isGrounded) {
			isGrounded = true;
		}
		if(Input.GetKey(KeyCode.RightArrow) || Input.GetKey(KeyCode.LeftArrow)) {
			transform.Translate(Input.GetAxis("Horizontal")*moveSpeed, 0,0);
		}
		if(isGrounded && Input.GetKey(KeyCode.Space)) {
			isGrounded = false;
			old_y = transform.position.y;
			rigidbody2D.AddForce(Vector2.up * jumpForce);
		}
	}

	void OnColissionEnter(Collision col) {
		if(col.collider.tag == "ground")
			isGrounded = true;
	}
}