C++ Cannot make Int

Hi!

My problem is simple: I want to make an Integer Variable in C++ and call that in Blueprint.

This is my code:

http://puu.sh/9Fnp3/d181415f15.png

It is inside my Character.h

And here is the error message I am getting:

http://puu.sh/9FnD4/92c2f2f09a.png

try this:

UPROPERTY(EditAnywhere, BlueprintReadWrite)
int32 Value;

You need to use int32 for something like that. It’s BP friendly

Yeah, int is ambiguous, it could be 32 bit or 64 bit depending on the architecture.

You have to use types like int8, int16, int32, int64 for Blueprint to work with them.

Thank you for the Help.
But “Damage” doesn’t appear in the Blueprint :confused:
You can see above I first define Health, then Damage.
Why does Damage not appear in BP? (I used Int32 for both)

This might sound silly but when you created your BP did you tell it to inherit from the C++ class that has those props?

like this:

notice in the top right it says that it’s inheriting from ProjectRPGItem.h and you can see some of the custom stuff I have in there as far as props go.

And in here you can see the code that puts them there:

You should place UPROPERY(…) before each single property you want to expose to the engine. Hope this helps?

Btw. here is the excellent documentation for UPROPERTY(…). There are all primitive types listed. Unreal Engine UProperties | Unreal Engine Documentation

yeah, I didn’t know I had to do UPROPERTY before every variable.
I thought I could group them :stuck_out_tongue:
Thanks, works now :slight_smile: