# Gameobject does not derive from MonoBehaviour

I am trying to put a gameobject into a prefab. Unity says "You are trying to save a Prefab that contains the script 'NPCDebugInfo', which does not derive from MonoBehaviour. This is not allowed. Please change the script to derive from MonoBehaviour or remove it from the GameObject 'yourgameobject'.

However, I don't see what I should do.

The script in question looks like this:

using System.Collections;
using System.Collections.Generic;

using UnityEngine;
using UnityEngine.AI;
using UnityEngine.UI;

public class NPCDebugInfo : MonoBehaviour
{
public Transform ThePlayer;//public so that we see it in the IDE. If we don't want that, make it private

...


I don't know what Unity really means and wants from me. What could I do to make this error message go away?

ps: For a clean test, I have created an empty gameobject and tried put my script onto it. Unity says "The script is an editor script."

So I will first find out what goes on here and why the script is actually on the other gameobject.

Thank you!

• There is a missing closing bracket. If this is just a pasting here issue then make a small change to the file and save it, wait for Unity to apply the change, restore to the original version and save it again. This sometimes fixes it if there are no other/real issues. Dec 26 '21 at 10:01
• @Nikaas Thank you, but I don't see what you mean. I have cropped / trimmed the code. Is that what you mean? Dec 26 '21 at 10:29
• Yes, on my phone I see the code just ending with ThePlayer variable row (now on PC it shows as being "cut"). BTW are the file and class names the same? Dec 26 '21 at 10:40
• @Nikaas Yes, thank you, file and class names are the same. I think the problem is that it's an Editor script. I will edit my question as soon as I know more. I think I already have a clue... Dec 26 '21 at 10:45