How to use GetSprite()

Hello Everyone,

I have a class that inherits from APaperCharacter, and I want to get the sprite instance from APaperCharacter and set its relative rotation with the code below.

GetSprite()->RelativeRotation = FRotator(-60.f, 0.f, 0.f);

Unfortunately I get the error “pointer to incomplete class type is not allowed” as seen in the picture below.

78308-error.png

Does anyone know how to achieve my desired result and what is GetSprite() used for if you can’t call functions on it?

It seems like the UPaperFlipbookComponent* is only forward-declared at that point.

Have you included “PaperFlipbookComponent.h” in your source file? I don’t know what the proper include path is right now, probably something like:

#include "Engine/PaperFlipbookComponent.h"

Thank you for your answer. It looks like “Engine\PaperFlipbookComponent.h” is not the correct path.

How would you find the correct path? I looked through the documentation here and couldn’t figure it out.

Hey

The PaperCharacter.h and PaperFlipbookComponent.h files are saved in the same folder so when adding the include for PaperFlipbookComponent.h, there is no need for “Engine/” at the beginning.

Additionally, just as a coding practice it would be better, rather than accessing the RelativeRotation variable and setting it directly, to use the SetRelativeRotation() function which takes in an FRotator argument of what you want the new rotation to be.

Cheers

That did the trick! Thank you @ for you help and good advice.