Constantly refusing to just work properly
Reference error o reference error, I tried both cases of Rigidbody
Yet neither worked, despite every case tried, despite following this tutorial absolutely;
Reference error o reference error, why do you do this to me?
Here’s the code:
using UnityEngine;
using System.Collections;
public class PlayerController : MonoBehaviour
{
public float speed;
void FixedUpdate ()
{ float moveHorizontal = Input.GetAxis("Horizontal");
float moveVertical = Input.GetAxis("Vertical");
Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);
Rigidbody.AddForce(movement * speed * Time.deltaTime);
}
}
I’m very, very new at the use of this whole coding thing, but I follow that guy’s tutorial to the dime and I keep getting this one specific error that just will not go away:
Assets/Scripts/playerController.cs(13,27): error CS0120: An object reference is required to access non-static member `UnityEngine.Rigidbody.AddForce(UnityEngine.Vector3, UnityEngine.ForceMode)’
Every time, every attempt, no amount of trouble shooting does any good. Is there something inherently wrong with the code? Is the tutorial I am using already that outdated? I did some research and the problem pointed to case sensitivity, but despite trying Rigidbody, rigidbody, and even RigidBody I keep getting this exact same error!
It’s to the point where I don’t think it has anything to do with case sensitivity yet the console points to the error being on that exact line.
I hope one of the folks here can help explain to me what i’m doing wrong- as I just have no clue what the issue is.