3
\$\begingroup\$

Sometimes I need to change a lot of files and Clean and Rebuild the Solution to get the changes on Unity, am I missing some configuration on Visual Studio or Unity? I uninstalled everything and make a clean install and few days later I'm getting the same problems.

Sometimes if I create a stardard MonoBehaviour script from Unity and I try to attack it to a gameObject I get the error: "Can't add script component XXXXXX because the script class can't be found"(see image: screenshot). The class name and file name are the same, with no syntax errors.

Some times opening a file with an external editor changing the encoding, cleaning and rebuilding the project solves the problem, but just sometimes and I'm tired of do that for test any change, now I have a lot of Debug.Log just to check if Unity is getting my code changes.

Any suggestion will be very greatful

\$\endgroup\$
  • \$\begingroup\$ Not sure if it's the same as what I was experiencing... I had a few issues a few months back where Visual Studio Intellisense would just not work for any new script created in Unity. Closing and re-opening it never fixed it. Sometimes it would just start working again, but it was annoying. I then came across a solution here (see the accepted answer) developercommunity.visualstudio.com/content/problem/130597/… \$\endgroup\$ – JacketPotatoeFan Feb 9 '18 at 12:58
0
\$\begingroup\$

There's no configuration that I can think of but I fix this problem by creating and deleting my scripts inside of visual studio. If you have your VS working with Unity then you should be able to create a "MonoBehaviour" script within the IDE itself.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.