Can't Add Script Behavior...
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!
It say can't add "Package base test". Unity is looking at the wrong script to add.
Or you are trying to add script from inside folder "Editor"
Try add script from inside GameObject Inspector. $$anonymous$$ight help
I'm not trying to add a script from an "Editor" folder, so that's not the issue. When I try to add a script I've already made via the GameObject Inspector, none of my scripts show up. When I add a script via the Add Component --> New Script option it lets me create a new script, but then it still says there's "No $$anonymous$$onoBehaviour scripts in the file" even though clearly it is. Good thoughts, but no luck yet.
Answer by ismadi · Jul 27, 2018 at 02:10 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 script MonoBehaviour name same with script filename. That's all.
This does not help solve my problem. Any new script I make still has this same issue and this issue applies to every single script in the project.
This error came after u upgrade ur Unity so $$anonymous$$onoBehaviour cannot recognize ur script. The other way is, move all your script outside from Unity project & add 1 by 1 and reset every script u have insert it.
I don't understand what you mean by "reset every script u have insert it". I've tried deleting scripts and re-adding them before, but any new script I make still has the same issues.
Answer by NoDumbQuestion · Jul 27, 2018 at 04:09 AM
Look at your Console. You got an error in a script(MoveMode.cs). That's why unity don't want you to add any more script until you fix that error.
I can see clearly that MoveMode.cs have mistype function inside it.
I fixed the $$anonymous$$ove$$anonymous$$ode.cs script and still have the same project-wide issues.
Your answer
Follow this Question
Related Questions
Getting error on lap counter script JS 0 Answers
"The associated script cannot be loaded" 0 Answers
"The associated script cannot be loaded." 0 Answers
Object reference not set to an instance of an object (c#) 0 Answers
cannot convert from 'Unity.Entities.Entity' to 'Unity.Entities.EntityQuery' 0 Answers