Why am I Getting Unrecognized type 'int'?

So i’m trying to create a basic Actor based class

A Coin, you pick it up, you get X amount of points (as decided by a variable)…

In BP this is a fairly simple thing, but in C++ It won’t work like expected,

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Actor)
	int CoinValue;

Is what i have so far, and i keep getting compiler errors that say ‘unrecognized type ‘int’’

Bool works, int8 works (yet shows up as a Bad type in BP editor), but int won’t work

I see! Thanks for the help!

use int32

EDIT:

Or, you could have an enum to represent the different values assuming they are static. Like what I did for item types:

    UENUM(BlueprintType)
    enum SubitemType
    {
        food UMETA(DisplayName = "Food"),
        drink UMETA(DisplayName = "Drink"),
        healing_potion UMETA(DisplayName = "Healing Potion"),
        posion_potion UMETA(DisplayName = "Posion Potion"),
        fire_potion UMETA(DisplayName = "Fire Potion")
    };

#Dont Use Type Int

This was just recently addressed here:

Dont ever use type int!

and dont use int8 in blueprints, its not working yet

Use uint8, int32, uint32 for maximum happy happy

#UE4 Documentation Link

"Don’t use the C++ int type in portable code, since it’s dependent on the compiler how large it is."

Rama

you’re welcome!

please check mark my answer and other people’s answers when your question is resolved so Epic knows the situation is under control :slight_smile:

Why is using the float type acceptable?

One quick addition to Rama’s reply. Do not use uint32 for Blueprint as it is unsupported type. Only data types supported by Blueprints are uint8, int32 and float.

See this reply from Epic for more info: Missing support for uint32 int64 uint64 - C++ - Unreal Engine Forums

too bad uint doesnt work with blueprint