"The class named is not derived from MonoBehaviour or ScriptableObject!", although class is derived from MonoBehaviour

I keep getting the error “The class named ‘OldManSounds’ is not derived from MonoBehaviour or ScriptableObject!”. I have researched this, and seen that the solution is usually to add “: MonoBehaviour” to the class declaration. However, my class declaration is as follows:

public class OldManSounds : MonoBehaviour {

yet I still receive the error, even though I’m stating that it’s derived from MonoBehaviour. How can I fix this?

If you are using assembly definition (.asmdef) files:
Make sure the script is not limited to the editor platform

Its as I said in the comment above. Remove the line “using UnityEditor” and all will be well :wink: