vrtex
vrtex

Reputation: 165

Unreal Engine blueprintable UFUNCTION on component causes build error

I've created a class derived from UActorComponent and I want to make few of it's methods BlueprintCallable. However adding this to UFUNCTION macro causes build errors. The class header looks like this:

#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "Includes.h"
#include "Items/ItemInfo.h"
#include "Inventory.generated.h"

UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent))
    class UNTITLEDGAME_API UInventory : public UActorComponent
    {
        GENERATED_BODY()

    public: 
        // Sets default values for this component's properties
        UInventory();

    protected:
        // Called when the game starts
        virtual void BeginPlay() override;

    /*
    *some other methods 
    */
    public:

        UFUNCTION() // like this it's fine, but if I put BlueprintCallable or BlueprintPure keyword here it causes troubles
            uint32 GetNumberOfItems() const;
    };

I can't figure out how I'm supposed to make it work, especially since it worked in one of my previous projects. Can anybody help me with this?

Upvotes: 1

Views: 1333

Answers (1)

SRombauts
SRombauts

Reputation: 448

The problem is that the uint32 type is not supported by Unreal Blueprints: you have to stick with int32 (or uint8 / Byte)

Upvotes: 4

Related Questions