Question by
dragonking300 · Jun 20, 2016 at 11:50 AM ·
scriptingproblem
I'm a newbie to scripting and I tried the roll a ball tutorial and got a error with my script
Error: cannot add script component (insert name of scirpt here) because the script class cannot be found
I used the EXACT script from the roll a ball tutorial but It gives me this error >:(
using UnityEngine; using System.Collections;
public class PlayerController : MonoBehaviour {
public float speed;
private 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 * speed);
}
}
Comment
You've most likely got a typo in the script name. In C# the name of the file has to match the class name.
In this case PlayerController.
Your answer
Follow this Question
Related Questions
How do I stop the player from shaking in Unity2D? 2 Answers
Unity crashes when compiling this script. Where is the problem? 0 Answers
Trigger stuck at full in state machine 0 Answers
How can i get this script to work ???? 0 Answers
Attack Script 2 Answers