I have read all the example scripts and they do not reference a component within the game. The script I am trying to run references the component ‘RigidBody’ and errors out when trying to test movement on a character in the game.
using UnityEngine;
using System.Collections;
public class PlayerController : MonoBehaviour {
public Rigidbody rb;
void Start ()
{
rb = GetComponent<RigidBody>();
}
void FixedUpdate()
{
float moveHorizontal = Input.GetAxis("Horizontal");
float moveVertical = Input.GetAxis("Vertical");
Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
rb.AddForce(movement);
}
}