My class name and script name matches but I cannot drag the script to the inspector. it is throwing the error “the associated script cannot be loaded, please fix any compile errors and assign a valid script”. There are no errors in my console. When I tried to add via “Add component” since dragging did not work, the script name did not even show up in the inspector…
I think this might have something to do with me switching to vscode, then back to visual studio community 2019 after I realised my intellisense only worked on visual studio community 2019 somehow…I’m not sure if this is relevant, but when I opened the script with Visual studio community 2019 and updated it with new lines of code and then opened the same script with VSCode, the updates could not be seen in vscode.
The project settings I toggled with before this issue arised was the external tools settings to switch between the different code editors, as can be seen in the screenshots below.
To try to fix it, I have:
- restarted unity
- regenerated csproj files
- reimported everything
- copied the contents of my script somewhere, then deleted it created a brand new script to paste the contents. i still received the same error and can’t assign the new script anywhere, it’s as though my editor cant detect the presence of the script.
what should i try next to fix this? thank you.
1