I have been coding my FPS controls with the tutorial in the wiki, hit a bug and spent almost a whole day finding it, eventually just rewrote everything to see at what point would it break, and it seems that the following line is the problem:
ASurvival::ASurvival(const class FPostConstructInitializeProperties& PCIP)
DefaultPawnClass = AChar::StaticClass(); //Error here!?//
I think you are confusing between Char and Character. To me it seems like you want to include “Character.h” and have ACharacter::StaticClass() assigned to your DefaultPawnClass.
My character is named “Char”, so I don’t think that’s the case… (In tutorial, they include FPSCharacter.h, and the character is named “FPSCharacter”, where I named it just “Char”)
What is the exact error you are getting ? I think the problem could be that UE has its own AChar class which deals with text input. You might be causing some conflict by using the same name.
In any case more details about the error would help sort out this issue. Also a code snippet of your Char class would go a long way in helping debug the issue too.
in the header only “custom” line is:
virtual void BeginPlay() OVERRIDE;
(it’s located just under GENERATED_UCLASS_BODY() )
in the .cpp custom lines are
Super::BeginPlay(); /** maybe a bug? */
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Blue, TEXT("We are using the character!"));
‘A’ prefixed classes are actors only, i highly doubt there are any classes that deal with input processing directly.
This seems completely fine, the problem is elsewhere. Again more information is needed otherwise it will be just guesses as to what could be wrong.
Have you tried a Clean solution and Rebuild? Sometimes this helps. Also if you recently rewrote everything, are you sure your source files are in the right place, ie not in the intermediate folder?
I started the project over again (as it consisted of nothing but the code).
hmm… all I know is that the errors came up when I wrote the line
DefaultPawnClass = AChar::StaticClass();
Which did something odd, as even if I comment every single line I have “manually” added (=not written by the class creation wizard) I’m getting 112 errors which all lead to the [projectName].generated.cpp, well most of them (some are leading to UObjecthash.h, or other similar (engine?)files.)
Did you add a character class to your project and then manually change the name of the class to Char? That is the only way I was able to get that to work, since the Add Code to Project wizard in the Editor would not allow me to add a new class named “Char” because there is already a
Char.h file in the Engine source code that defines the TChar type.
I was able to get it to work without any error messages, but I would strongly recommend that you choose an alternate name for your character class to avoid any potential conflicts between your
Char.h and the Engine’s
no, I think I somehow slipped through the security with it. I did start using “PlayerChar” instead, which is working fine