UPROPERTY Compiler Error with BlueprintReadWrite

I made c++ class that uses ue4’s Actor as the parent. I am trying to make the variables usable within blueprints. Whenever I try to add any blueprint key words into UPROPERTY() it gives me a compiler error. I can use VisibleAnywhere, EditAnywhere, Category, etc, without any compiler errors at all.

Gives me compiler errors

#pragma once

#include "GameFramework/Actor.h"
#include "MyActor.generated.h"

UCLASS()
class JUNGLE_DUNGEON_API AMyActor : public AActor
{
	GENERATED_BODY()

	
public:	
	// Sets default values for this actor's properties
	AMyActor();

	// Called when the game starts or when spawned
	virtual void BeginPlay() override;
	
	// Called every frame
	virtual void Tick( float DeltaSeconds ) override;

	
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Int")
		int16 MyInt;
};

No Compiler errors

#pragma once

#include "GameFramework/Actor.h"
#include "MyActor.generated.h"

UCLASS()
class JUNGLE_DUNGEON_API AMyActor : public AActor
{
	GENERATED_BODY()

	
public:	
	// Sets default values for this actor's properties
	AMyActor();

	// Called when the game starts or when spawned
	virtual void BeginPlay() override;
	
	// Called every frame
	virtual void Tick( float DeltaSeconds ) override;

	
	UPROPERTY(EditAnywhere, Category = "Int")
		int16 MyInt;
};

What am I doing wrong?

Hi,

Your variable “MyInt” is of type int16, which is not supported in Blueprints. The only numerical types supported in Blueprints are uint8, int32 and float.

Also see this Question: Missing support for uint32 int64 uint64 - C++ - Unreal Engine Forums

So basically you need to change your variable to int32 and everything should work fine.

Cheers,
Elewyth

Thanks for the help.

If that solved your problem, would you mind accepting my answer? That way anyone with a similar problem can see right away, that the problem has been solved, and will more likely click on this question, when looking for an answer :slight_smile:

Thanks for this, I spent half an hour googling with nothing coming up. This info really should be added to the Blueprint specifiers in the UPROPERTY docs.