Unrecognized type 'UInputComponent'

This error occurs in Actor.h (the engine code).

I had a fully compiling project before renaming one of the files and its corresponding class name. I made sure to change the name in all import statements and code references. However, the error persists even after undoing my changes. What could have caused this error and how can I fix it?

Can you post the exact error?

Unrecognized type 'UInputComponent' - type must be a UCLASS, USTRUCT or UENUM at /4.14/Engine/Source/Runtime/Engine/Classes/GameFramework/Actor.h(319).

Tried doing all three several times, then tried deleting all modified code and then doing #3 again several times to no avail. Are there any other ways to try to fix this?

I thought that might have been the case too, but the built engine code has no compile errors (when I build the entire solution, there’s 1 success and 1 failure–the failure is only with my game code). Thanks for the idea though, right now I’m downloading the latest engine version to see if an update will work (or if it’ll even let me update). If not then I’ll reinstall 4.14, and if that doesn’t work I guess I’ll just have to recreate the entire project…again. <_<

Can you post everything in your output log?

Upgrading to 4.16 miraculously fixed all my issues. For future reference, what would be the preferred way to rename files and their contained classes? I did everything through VS (right clicked on the files in Solution Explorer) and used Visual Assist X to refactor the class name.

I managed to fixed the error by upgrading to 14.6, but as I recall that error was the only weird thing in the output log (the rest were messages about being unable to compile due to that error).

You probably have some bad generated header files hanging around.

  1. First, try “Clean Solution” from the build menu, then “Rebuild Solution”
  2. If that doesn’t work, right-click on your UProject file and generate Visual Studio Project Files, then do 1 again.
  3. If that doesn’t work, delete your Project/Intermediate and Project/Saved folders (cut and past ethem somewhere else to be safe), then do 2 and then 1 again.
1 Like

Hmm, the bad generated files is usually the cause of things like this.

Is it possible that during your rename/move operation you modified or deleted an engine source file? Maybe try reinstalling the version of UE4 you’re using from the library, and then recreating visual studio files?

Honestly? You should avoid it if at all possible.
When I really have to, I rename from visual studio, and then close VS, then do a “generate VS files” a clean and a rebuild. That generally does it.
The real problem, though, for which there’s really no solution, is that you have to be extremely careful renaming any classes which Blueprints have either inherited from, or have had custom data added to.
If you rename a class, the editor freaks out because now it can’t find it any more. This invalidates the parent class of all blueprint classes which inherit from it. It’s possible to reparent a blueprint, however, you have to be able to open it to do so, but opening a blueprint with an invalid parent class just causes a crash so you can’t. You have to either be prepared to delete and recreate all derived blueprints, or you have to make a copy of your class with the new name, compile, reparent all of the blueprints inheriting from the class with the old name, and then delete the old version of the class.