- Home /
cant add script because it doesnt exist
I am trying to attach a piece of code to an object in my game and every time I do I get an error saying it doesn't exist and the class and file name don't match but it does. PLease help.
At the very bottom of your screenshot, you'll notice there's a compiler error in your console. If you just created the Follow
script, Unity doesn't recognize it yet because you haven't successfully compiled.
As for the error: it looks like you might be missing a semicolon, but compiler errors are famously difficult to interpret, so it's hard to say for sure without seeing the script.
I keep creating new scripts, but even new scripts will not attach to any objects. Even the just freshly created ones...
@Crat50 what did you do because I am having the same problem
Answer by Dracorat · Jul 22, 2014 at 10:14 PM
In MonoDevelop go to the Build Menu, clean the project and then build it again.
If it does not build due to some error, you will need to correct that error first.
In some cases, a restart of Unity 3D may be required.
Otherwise, after the build you should be able to attach the script.
That's what I've been doing. When that doesn't work, if you copy and paste the contents of the nonexistent script to a new one with the same name, it should work. That's what I had to do.
Answer by keshavmix · Aug 01, 2015 at 04:02 PM
Make sure the name of the file and class name should be same.
I resolved this issue..
Your answer
Follow this Question
Related Questions
Error BCE0018 0 Answers
what is the compile error on this script? 2 Answers
Unexcpected Token error with transform.find 2 Answers
WARNING : Assignment to temporary. 1 Answer
Access is denied in Windows 8 App 0 Answers