When I try to inherit it’s like if editor don’t detect the class (sure that’s the appearence, probably I fail somewhere) but I can’t find the mistake. Here is the code:
class RPG_API ARPGCharacter : public ACharacter, IControllableCharacter //Here the mistake
ARPGCharacter(const class FObjectInitializer& FObjectInitializer);
virtual void MoveVertical (float Value);
virtual void MoveHorizontal (float Value);
XCode tell me “Expected class name” and mark the IControllableCharacter.
Here is the definition of IControllableCharacter:
class RPG_API UControllableCharacter : public UInterface
class RPG_API IControllableCharacter
virtual void MoveVertical(float Value);
virtual void MoveHorizontal(float Value);
If you need to see more code (to find the mistake) here is a link to the proyect in Github: link text
Sorry if the question is very simple, I’m starting now with Unreal Engine, in fact, I’m following a book for this proyect but it must be a mistake because I have exactly the same code than the book.
And the other little problem is the next, the book use this code:
Firstly I had the public aclarations but it doesn’t work (the same problem).
The UFUNCTION you say , I don’t need it (now) because I’ll use c++ and, I’m not sure but I think this macro is for blueprint no??
And for the input component (the book) don’t use the constructor, it use a method, here is.
The header (.h) :
class RPG_API ARPGPlayerController : public APlayerController
void MoveVertical(float Value);
void MoveHorizontal(float Value);
virtual void SetupInputComponent() override;
I think you are mixing implementations. If you are using the interface in a purely c++ implementation, you can do this without having to expose them to blueprints. But I think you’d still need to use
Does the project compile at this point? I can really on go off what I have been able to do, I don’t have a lot of theoretical knowlege on this. I have tons of interfaces implemented and all are accessible through blueprint as well as code. Additionally, you still need to use ‘public’ to access the public members of the interface. You might need to check and include the interface’s header file.
If it says that it expects a class name it simply means that your IControllableCharacter has not been recognized as a class when parsing your header file. Did you forget an include? Try including IControllableCharacter in your header file
I will just answer the fix to your error, since the other question is not related to inheritance.
Your error message basically tells you that the compiler could not recognize the class as a class. In other words: It does not see its class definition. Simply include the respective header file appropriately.
As you already noticed, the include must happen before the XXX.generated.h, which always has to come last.