"rb" does not exist: Error CS0103
Hello, I am new to c# and unity. I am doing the roll a ball tutorial and am getting an error. CS0103.
Here is my code:
using UnityEngine; using System.Collections;
public class PlayerController : MonoBehaviour {
private Rigidbody rb;
void Start ()
{
rb = GetComponent<rigidbody>();
}
void FixedUpdate ()
{
float moveHorizontal = Input.GetAxis ("Horizontal");
float moveVertical = Input.GetAxis ("Vertical");
Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
rb.AddForce (movement);
}
}
It states when I scroll over the Private Rigidbody rb; in the editor, that the name Rigidbody does not exist in the current context. I don't know what to do. PLEASE HELP!
Answer by ArturoSR · Aug 28, 2017 at 09:06 PM
Hello there, just change to this:
GetComponent<Rigidbody>()
The rigidbody does not exist as lowers, actually, all the components start with a capital character (Rigidbody, Transform, AudioSource, etc.).
Your answer
Follow this Question
Related Questions
roll a ball tutorial 3 of 8 playmode camera error 1 Answer
Mob.opponent' is a `field' but a `type' was expected help please! :) 1 Answer
ERROR CS0029: Cannot implicitly convert type `UnityEngine.GameObject' to `TriggerSphere' 1 Answer
Moving Scene To a Different Computer And Everything is Gone! Please Help! 0 Answers
Issue with class constructor. 1 Answer