- Home /
Question by
sbryant73 · Feb 16, 2014 at 04:15 PM ·
script error
Roll a Ball tutorial
I am trying to do the roll a ball tutorial and when i write the script word for word like the tutorial I get the error...
"The class defined in script file named 'PlayerController' does not match file name!"
this is my code
using UnityEngine;
using System.Collections;
public class PlayerController : MonoBehaviour
{
void fixedupdate()
{
float moveHorizontal = Input.GetAxis ("Horizontal");
float moveVertical = Input.GetAxis ("Vertical");
Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
rigidbody.AddForce (movement);
}
}
please help Thanks
Comment
Answer by robertbu · Feb 16, 2014 at 04:16 PM
In C# the name of the script file must match the class name. So in Unity, you need to rename the file that contains this script to 'PlayerController'.
The script file is called PlayController.cs, should i change it?
Thanks
The files must match exactly. So the file name must be 'PlayerController' not 'PlayController'.