Question by
LandscapeGame · May 26, 2017 at 12:03 PM ·
rigidbody
Error CS0103 : The name rb does not exist in the current context
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class PlayerControllerDefinite : 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);
}
}
I am new to Unity and game development so I don't know what to do, at the rb Addforce part, it keeps showing me Error 0103, how do I fix this?
Comment
Answer by starscream97 · May 26, 2017 at 04:54 PM
Uncommenting the first line (private rigidbody rb) and in the start will work i guess
Your answer

Follow this Question
Related Questions
Why is new Vector3 stronger when player is in the air? 0 Answers
Figuring out what the acceleration will be before applying force to RigidBody2D 0 Answers
Strange physics on RigidBody when Collider enabled (locked axis) 2 Answers
Is there any reason to have a rigidbody on a gameobject that doesn't have a collider? 1 Answer