- Home /
Can't Add Script Behaviour...
I've been struggling with this issue for about two days now, trying everything I could find via searching the web etc.
All of my scripts suddenly stopped working. Under the inspector, they all say "No MonoBehaviour scripts in the file, or their names do not match the file name." All of my scripts have classes that match the file names and all are properly extending MonoBehaviour.
What's really weird is when I try to drag a script onto a GameObject, I get this sort of error message:
It used to be "Can't add script behaviour TMP_CoroutineTween. To attach a script it needs to be derived from MonoBehaviour." (Or something to that effect, best I can remember.)
I've tried closing and opening Unity. I've tried restarting my computer. I even uninstalled Unity and did a fresh reinstall of it. I'm new to Unity, so maybe there's something obvious I'm missing, but for the life of me I can't figure it out. I don't recall taking any particular action that seemed to trigger this error, I just opened my project to start work again for the day and suddenly none of my scripts worked.
Thanks in advance for your time and help!
Something like this sometimes happens to me. I go into monodevelop a d press F7(Builds the project, checks for errors) If an error in there shows up I double click it and sometimes it takes me to an xml document and i delete the line its complaining about which isn't important anyways and then it works good.
Secondly all editor scripts must be in just a base folder called EDITOR that is the problem its giving you in that error on screen in the image
Answer by ismadi · Jul 27, 2018 at 02:13 AM
FIXED > open script , copy all text, delete that script, create a new script name, different with previous name, paste all script to a new script & make sure a script MonoBehaviour name same with a script filename. That's all.