So, I'm trying the roll-a-ball tutorial, but when I follow his exact instructions, something breaks. any ideas?
So, I'm trying the roll-a-ball tutorial, but when I follow his exact instructions and use this script:
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);
}
}
I get an error in the console reading "The referenced script on the Behavior is missing" and when I double click it to take me to the issue, it shows the scrip with a message reading "The associated script can not be loaded. Please fix any compile errors and assign a valid script."
What is going on, and is there any way to fix it?
$$anonymous$$ake sure your script name matches. In this case PlayerController.cs (case sensitive)
Answer by tebandesade · Dec 07, 2015 at 04:12 PM
Check in the script component if you have the script attached in the slot, if not add it by dragging it.
Your answer
![](https://koobas.hobune.stream/wayback/20220612032832im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Roll a Ball tutorial - Pick ups stop rotating when i add more than one 1 Answer
roll the ball - player not moving. Script seems fine,Roll a ball not rolling, should I add speed ? 1 Answer
Why am i getting a Null Referencce Expectation in roll a ball? 1 Answer
camera rotate and follow the ball 0 Answers