x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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:

alt text And I have the following blueprint graph in my user widget: alt text

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,

Product Version: UE 4.15
Tags:
c++code.png (3.7 kB)
c++code2.png (7.5 kB)
blueprint2.png (140.3 kB)
more ▼

asked Apr 27 '17 at 10:17 PM in C++ Programming

avatar image

shipster
1 1 2 3

(comments are locked)
10|2000 characters needed characters left

3 answers: sort voted first

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.

more ▼

answered Apr 28 '17 at 12:11 AM

avatar image

Teiwaz
619 26 28 55

(comments are locked)
10|2000 characters needed characters left

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.

more ▼

answered Apr 28 '17 at 01:27 AM

avatar image

Ben.Driehuis
491 18 27 142

(comments are locked)
10|2000 characters needed characters left

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.

more ▼

answered Apr 28 '17 at 10:47 AM

avatar image

Benergy
816 21 4 28

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question