Blueprint does not call my C++ Function property?

Hi!

This is really confusing me for a while now so I decided to ask this question:

I have a character defining the following method in the header file:
135863-
And I have the following blueprint graph in my user widget:

When I toggle my UserWidget, the “Event Show” is fired. But the debug message “Called Get Inventory!” never appears on screen.

When I do an “IS VALID” test on the inventory retrieved from the character, it is always “INVALID”.
What am I doing wrong?

Please help,

It sounds like the character which has spawned in the level isn’t actually a SurvivalCppCharacter so the cast is failing. Verify whether it is by getting the class of the character being returned by GetPlayerCharacter.

As Teiwaz said, its probably the cast isn’t working.

Now if your game is a multiplayer one or has split screen, then the issue could be the way you are getting the player character. For user widgets you should be using the function from that class to get the player controller/pawn. This is called Get Owning Player Pawn.

You should also check the result of the cast. Have you tried putting a break point in your code to see if it getting hit? You can breakpoint the blueprint as well, and see the value of your cast to make sure it is set.

I would guess that you cannot make an inline function BlueprintCallable. Perhaps removing the FORCEINLINE helps. Also, I would consider making the function BlueprintPure, because it is only an accessor for data.