Namespace IAction not found?

After Following the lecture on inverting dependencies using Interfaces, I have found myself stuck with an error (four times, but the same error) in the unity editor, all referencing the mention of “IAction”. VScode doesn’t seem to find any problems, but unity is stuck with these messages:


I understand what that error usually means (I forgot to mention “using (namespace)” in the script. However I followed all the directives, even watched the whole lecture again to make sure I hadn’t missed anything.
Here are my different classes and their Cancel() methods.
Mover:


Fighter:

Screenshot_5
IAction:

ActionScheduler:

Given that it’s a fairly simple error usually, I feel like I’ve missed something obvious here, but I can’t find what it is. I have tried many solutions proposed online, but nothing is working.

Thanks in advance for your support.

That is an odd one, as usually the issue is Visual Studio not keeping up with the changes, not the other way round.
Things to try:

  • Make sure that all files in VS Code are saved. If you see an * next to the file name in VS, it hasn’t been saved.
  • Try regenerating the project files in Unity - Edit|Preferences|External Tools
  • Exit Unity and restart
  • Exit Unity and delete the Library folder.

Deleting the library worked. Thanks!

That’s great. It’s amazing how a bug in Unity that has been identified well over six years ago still rears it’s ugly little head. It’s rare that it happens, but when it does, you’ll see things like this. Usually the mismatch is the other way around, where Visual Studio (especially Visual Studio Code) flags errors that aren’t errors. The common solution for that is regenerating the project files.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms