- Home /
All compiler errors have to be fixed, but no errors?
I am getting the "All compiler errors have to be fixed before you can enter play mode". No errors are shown in the footer, and no errors are shown in my script in MonoDevelop. I am new to programming so i am probably doing something else wrong, but i can't figure out what. Here is the only script I am using in c#. The public float also does not appear in Unity.
using UnityEngine;
using System.Collections;
public class PlayerController : MonoBehaviour
{
public float speed;
void Fixedupdate ()
{
float movehorizontal = Input.GetAxis ("Horizontal");
float movevertical = Input.GetAxis ("Vertical");
Vector3 movement = new vector3(movehorizontal, 0.0f, movevertical);
rigidbody.AddForce(movement * speed * Time.deltaTime);
}
}
only thing wrong with your code is that FixedUpdate is written with capital U, but technically that's not an error... rest should be... fine?
Answer by CHPedersen · Jan 14, 2015 at 07:46 AM
It's the lower case "vector3" you've written at line 13 in the code sample. That line should be:
Vector3 movement = new Vector3(movehorizontal, 0.0f, movevertical);
Sneaky bit there, eh? ;)
Edit: Oh, right. After compilation, you'll find that you're going to want to spell it "FixedUpdate" to ensure it gets called. Good observation, taxvi!