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 Library Function Not Entered

I have set up a Blueprint function library to use for callbacks for all my menu buttons in UMG. I'm not getting any error messages, but my ButonCallbackQuit function is never entered. Instead, it is skipped and the next function GetHappyMessage is run. Why is this?

alt text

In my header:

 UFUNCTION(BlueprintCallable, Category = "VictoryBPLibrary")
     static FString GetHappyMessage();

 UFUNCTION(BlueprintCallable, Category = "MenuUtilities")
     static void ButtonCallbackQuit(AActor * actor);

In my cpp:

 FString UMenuUtilities::GetHappyMessage()
     return FString("Victory! Victory BP Library Works!");
 void UMenuUtilities::ButtonCallbackQuit(AActor * actor)
     actor->GetWorld()->Exec(actor->GetWorld(), TEXT("quit")); // BREAK HERE

Thank you!

Product Version: UE 4.10
blueprint.png (81.6 kB)
more ▼

asked Jan 04 '16 at 08:02 PM in C++ Programming

avatar image

447 36 39 67

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

I believe you need to use the BlueprintPure specifier instead of BlueprintCallable

more ▼

answered Jan 04 '16 at 10:48 PM

avatar image

joeGraf STAFF
1.5k 35 12 69

avatar image calembendell Jan 04 '16 at 10:52 PM

won't blueprint pure mean i can't have any side effects?

avatar image joeGraf STAFF Jan 04 '16 at 11:17 PM

Yes, but that's required for static functions. BlueprintCallable shouldn't be on static functions.

avatar image calembendell Jan 05 '16 at 05:12 AM

so should i change the function to be nonstatic? changing the function to blueprint pure makes it seemingly unusable. sorry, i'm not sure what to do to accomplish the goal of setting up my sample c++ code to be used in blueprints. should i maybe remake a more general question?

avatar image Shadowriver Jan 05 '16 at 05:20 AM

May i ask why? I seen lot of non-pure static functions in KismetXXXLibrary classes

But Get functions indeed should be pure

avatar image joeGraf STAFF Jan 05 '16 at 04:49 PM

Static functions can't access instance state. BlueprintCallable implies that it is calling it on the instance. Libraries don't really have an instance so that's fine. Doing the same on some Actor derived class would not be correct

avatar image calembendell Jan 04 '16 at 11:00 PM

when i change the button callback to pure, it no longer has an exec pin for some reason

avatar image Shadowriver Jan 05 '16 at 05:23 AM

Whats what Pure nodes is, they are getter nodes called if needed by blueprint VM to get output value, because of that they should not set/change anything only get or compute. You should definitely use them on "Get Happy Message"

avatar image calembendell Jan 05 '16 at 07:54 PM

i did some further debugging and found that the library function was being entered and silently failing with an access violation, producing no side effects. i opened a new issue to determine if that is intentional behaviour or to see if i'm doing something horribly wrong.


avatar image calembendell Jan 24 '16 at 07:21 PM

so far i've not received an answer as to whether or not this behaviour is a bug or if it is intentional

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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