Very new to Unity, but not to making games. I am a Designer/Producer/Artist, not a programmer, though. Sorry if this is a dumb question, but I cannot find the answer when I search, so I am posting.
I am trying to do the Roll-A-Ball tutorial here: http://unity3d.com/learn/tutorials/projects/roll-a-ball/moving-the-player. I have followed every step through creation of the script (below) and when he saves his script (about 9:50) he then proudly says that there are no errors in the console. But, I have errors.
I am sure I did something wrong, but cannot for the life of me figure out what. Here’s the script:
using UnityEngine;
using System.Collections;
public class PlayerController : MonoBehaviour
{
void FixedUpdate ()
{
float moveHorizontal = Input.GetAxis("Horizontal");
float moveVertical = Input.GetAxis("Vertical");
Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);
Rigidbody.AddForce(movement);
}
}
But I get this error at the end:
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)’