Rigidbody 2D in C# and Vector 2

G’day there,

I’m unsure how to reference Rigidbody2D instead of the standard, 3D rigidbody in my C# script. I did try rigidbody2D without any luck, how should I go about doing this?

I was also told for 2D I should use Vector 2, yet when I change my Vector3 to Vector2 I get the following error, ‘error CS1729: The type UnityEngine.Vector2' does not contain a constructor that takes 3’ arguments’ and a couple of other similar errors about the change.

Below is my script… Thank you! :slight_smile:
using UnityEngine;
using System.Collections;

public class Jump : MonoBehaviour {

	//Controls Player Jump Height
	private int jumpHeight = 10;
	void Start () {

	void Update () {

		if (Input.GetButtonDown("Jump") || Input.GetKey ("w")) {

	void DoJump (){
		rigidbody.AddForce(new Vector2(0, jumpHeight,0), ForceMode.Force);


rigidbody2D.AddForce(new Vector2(0, jumpHeight), ForceMode.Force);

i.e. no z component in vector2.