"the referenced script on this Behaviour is missing"

Hi there,

I am really new in Unity 5 and I ain’t programmer. I have been playing around with some C# scripts here and there until this issue arise (The referenced script on this Behaviour is missing)…#%* I have googled answers such us “Remove the missing reference from your GameObject. You attached your script to something, remove the now missing component, and done.” but I have no idea how to implement these actions in Unity 5.

I would really appreciate some help!!!
Thanks

Select the gameobject with the component in quetion. Then, in the inspector, left click on the icon at the top right corner of the component the error is about and select “Remove component” from the drop-down list.

1 Like

Your trying to access a script on a GameObject which the script is not properly attached, so you can simply fix by adding that script to the GameObject.

In the inspector on that gameobject you should see this :

Press the settings icon in the top right and then select Remove Component as seen here below :

then you would simply need to re-add the said script to the GameObject

1 Like

Duugu and 5vStudios thank you very much for providing help!!! After detaching/reattaching and copy pasting new C# scripts on my capsule I now get “error CS0101: The namespace ‘global’ already contains a definition for Controller”

Basically I am trying to create a character controller for a space racing game I have in mind following THIS tutorial on how to create a character controler. So far I wrote:

using UnityEngine;
using System.Collections;

[RequireComponent(typeof(CharacterController))]

public class Controller : MonoBehaviour {
public float MoveSpeed;
public float RotationSpeed;
CharacterController cc;
// Use this for initialization
void Start () {
cc = GetComponent();
}
// Update is called once per frame
void Update () {

Vector3 foward = Input.GetAxis(“Vertical”) * transform.TransformDirection(Vector3.forward) * MoveSpeed;
transform.Rotate(new Vector3(0,Input.GetAxis(“Horizontal”) * RotationSpeed * Time.deltaTime,0));
cc.Move(foward * Time.deltaTime);
cc.SimpleMove(Physics.gravity);
}
}

It seems that something in the code bothers Unity when attaching the script on me capsule.
What am I doing wrong???#*$!

That error is saying that there is already a script called ‘Controller’ so you need to rename your script and change :

public class Controller : Monobehaviour

change ‘Controller’ to whatever you rename your script to

5vStudios that got the job done!!! Thank you very much for replying! I’m a 3D artist and a noob when it come to game programming!!! Thanks a lot!!!

Glad to help