Hey, I’m trying to make a 2d game in UE5 and want to create a flipbook component in my pawn with a flipbook file which is saved in content folder. I tried linking it like this, following some tutorial, but I don’t think this is still working.
Kassadin.cpp (My pawn)
#include "Kassadin.h"
#include "PaperFlipbookComponent.h"
#include "PaperCharacter.h"
// Sets default values
AKassadin::AKassadin()
{
// Set this pawn to call Tick() every frame.
PrimaryActorTick.bCanEverTick = true;
// Structure to hold one-time initialization
struct FConstructorStatics
{
ConstructorHelpers::FObjectFinder kassadinIdle;
FConstructorStatics() : kassadinIdle(TEXT("C:/Programovanie/UE5/TheVoidWalker/Content/Animations/Kassadin/Idle/KassadinIdle.uasset"))
{
}
};
static FConstructorStatics ConstructorStatics;
// Property initialization
AnimationIdle = ConstructorStatics.kassadinIdle.Object;
// Defining Components and their properties
BodySprite = CreateDefaultSubobject<UPaperFlipbookComponent>(TEXT("bodySprite"));
BodySprite->SetFlipbook(AnimationIdle);
BodySprite->SetupAttachment(RootComponent);
Kassadin.h
#pragma once
#include "PaperCharacter.h"
#include "CoreMinimal.h"
#include "GameFramework/Pawn.h"
#include "Camera/CameraComponent.h"
#include "GameFramework/SpringArmComponent.h"
#include "PaperFlipbookComponent.h"
#include "Kassadin.generated.h"
UCLASS()
class THEVOIDWALKER_API AKassadin : public APawn
{
GENERATED_BODY()
public:
// Sets default values for this pawn's properties
AKassadin();
// Declaring Components
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = paper)
UPaperFlipbookComponent* BodySprite;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = paper)
UPaperFlipbook* AnimationIdle;
Thank you for your help