Recently I’ve decided to teach myself how to use Unity for a class (Independent Study to be specific) for school and while doing the 1st tutorial I have come across an odd error. After the second video “Move Player” when I try to compile I get an error saying “Assets/Scripts/PlayerController.cs(8,17): error CS0029: Cannot implicitly convert type UnityEngine.Rigidbody[]' to UnityEngine.Rigidbody’” currently the script I have written for it is
using UnityEngine;
using System.Collections;
public class PlayerController : MonoBehaviour {
private Rigidbody rb;
// Use this for initialization
void Start () {
rb = GetComponents<Rigidbody>();
}
void FixedUpdate(){
float mHoriz = Input.GetAxis ("Horizontal");
float mVert = Input.GetAxis ("Vertical");
Vector3 movement = new Vector3 (mHoriz, 0.0f, mVert);
rb.AddForce (movement);
}
}