Using C++ Variables to use in Blue Print

I’m In the Crypt Raider section, and I didn’t Like the fact in order to print it you need a Actor name

So I used a C++ Variable to Allow Me to Use Them in Blue print

But How?

You Just use a simple UPROPERTY but add another parameter
image

Then When you go to Blueprint you should be able to set a custom message In the editor, Then you Make it work in blue print

Proof it works:

OR you can use the variable to do it how it is in the video

2 Likes

in order to print it you need a Actor name

You don’t have to. Here, it was just to check which actor (the statue, the player, …) overlapped the trigger. If you don’t care about that, you can of course use whatever you want.

UPROPERTY(EditAnywhere, BlueprintReadWrite)

You don’t need BlueprintReadWrite is you already have EditAnywhere Never mind that one. EditAnywhere is not really anywhere, it’s actually only the property windows, so it doesn’t apply to blueprint code

When you go to Blueprint you should be able to set a custom message In the editor

Given what you’re presenting, you don’t need a variable in the component either. You could just put the string directly in the Print String node, or use Make Literal String, or use a blueprint variable instead.

you can use the variable to do it how it is in the video

Since Message is not used anywhere but for printing, it’s unnecessary complication to set the variable.

Privacy & Terms