When I try to run my game I get Assets/Scripts/PlayerMovement.cs(17,13): error CS0119: Expression denotes a `method group', where a `variable', `value' or `type' was expected
error message. Can somebody please tell me how to fix this?
Here is my code.
using UnityEngine;
using System.Collections;
public class PlayerMovement : MonoBehaviour {
public float moveSpeed;
private float maxSpeed = 5f;
public Rigidbody rb;
private Vector3 input;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (GetComponent.velocity.magnitude < maxSpeed)
{
input = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
}
GetComponent().AddForce(input * moveSpeed);
}
}
↧