Question by
LesageProdYT · May 21, 2016 at 08:33 PM ·
script error
Unity Script ERROR - CS0120
This is the error :
Assets/SCRIPT/PlayerMovement.cs(20,27): error CS0120: An object reference is required to access non-static member `UnityEngine.Rigidbody.AddForce(UnityEngine.Vector3, UnityEngine.ForceMode)' This is my code :
using UnityEngine;
using System.Collections;
public class PlayerMovement : MonoBehaviour {
public float moveSpeed;
private Vector3 input;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
input = new Vector3 (Input.GetAxis ("Horizontal"), 0, Input.GetAxis ("Vertical"));
Rigidbody.AddForce (input * moveSpeed);
}
}
Comment