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"

Invoke a "call" on event in c++ defined in Blueprint

I've created Event Dispatcher in Blueprint and assign an event, now i want to "call" it in c++. Thanks in advance.

Product Version: UE 4.20
Tags:
more ▼

asked Oct 10 '18 at 02:13 PM in C++ Programming

avatar image

kishindba
6 2 6 10

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

1 answer: sort voted first

You need to make a BlueprintImplementableEvent and call it in the delegate after it receives a response.

It doesn't need an implementation in C++, just a declaration in the .h and then calling it wherever you like.

Then you can override it in the BP, and it will be fired off when you receive your response. (AKA whenever you call this function in C++, it will fire in the child BP)

Your BP must be a child class of the C++ class.

Maybe something like this

 //FileBrowserBehaviour.h
 #pragma once
 
 #include "FileBrowserBehaviour.generated.h"
 
 DECLARE_DYNAMIC_MULTICAST_DELEGATE(FRefreshFileNameDelegate);
 
 UCLASS(BlueprintType)
 class POLYME_API UFileBrowserBehaviour : public UObject
 {
     GENERATED_BODY()
 public: 
     UFUNCTION(BlueprintCallable, Category = "File Browser")
     void SelectFile(FString FileName);
 protected:
     UPROPERTY(BlueprintAssignable, Category = "File Browser")
     FRefreshFileNameDelegate RefreshFileName;
 
     UPROPERTY(BlueprintReadonly, Category = "File Browser")
     FString FileName;
 };
 
 
 //FileBrowserBehaviour.cpp
 #include "PolyME.h"
 #include "FileBrowserBehaviour.h"
 
 void UFileBrowserBehaviour::SelectFile(FString NewFileName)
 {
     if (FileName != NewFileName)
     {
         FileName = NewFileName;
         RefreshFileName.Broadcast();
     }
 }
more ▼

answered Oct 10 '18 at 07:25 PM

avatar image

Pantong51
13 1 4

avatar image kishindba Oct 11 '18 at 07:34 AM

Thanks, i'll try it now

avatar image kishindba Oct 11 '18 at 09:05 AM

Thank you very much, it works perfectly ! )))))

(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