rb2d does not exist

i want to make my person move and i found a tutorial made by a unity dev person (i don’t know what to call them) and they said to put this in my script code thing. this is what my script looks like but rb2d does not work the error unity tells me is “Assets/scripts/playercontroller.cs(10,17): error CS0103: The name `rb2d’ does not exist in the current context” what does that mean how do i fix it i am an idiot and new to unity so if it is not to much trouble can you make it simple

  using UnityEngine;
  using System.Collections;

  public class playercontroller : MonoBehaviour {

private Rigidbody2D rb2;

void Start ()
{
	rb2d = GetComponent<Rigidbody2D> ();
}

void FixedUpdate () 
{
	float movehorizontal = Input.GetAxis ("Horizontal");
	float moveVertical = Input.GetAXis ("Vertical");
	Vector2 movement = new Vector2 (moveHorizontal, moveVertical);
	rb2d.AddForce (movement); 
}		

}

Thank you

2 Answers

2

Uhm, typo?

You have:

private Rigidbody2D rb2;

but it looks like you want

private Rigidbody2D rb2d;

@Bunny83 thank you for helping me with the rb2 error i fixed the rb2 and put the d making it rb2d but it still does not work

float moveVertical = Input.GetAXis (“Vertical”) ;
should be
float moveVertical = Input.GetAxis (“Vertical”) ;
System is complex and needs to be absolute on spelling so make sure you don’t have any more typos.