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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Cannot get BlueprintImplementableEvent or Delegetes to Fire

I can't figure this out, I am trying anything just to be able to get events to fire in blueprint from C++. I am 5 hours into this and nothing is working. Very frustrated.

Right now both events show up in a blueprint with parent class of AProjectGameMode , but I can not get them to fire when called.

   DECLARE_DYNAMIC_MULTICAST_DELEGATE(FBindableEvent);
     
 UCLASS(minimalapi)
 class AProjectGameMode : public AGameMode
 {
     GENERATED_BODY()
 
 public:
     UFUNCTION(BlueprintImplementableEvent, Category = "test", meta = (DisplayName = "C++ - test"))
     void test1();
 
     UPROPERTY(BlueprintAssignable)
     FBindableEvent test2;


They are called from another class in which gameMode is a pointer to an AProjectGameMode object, and which can call other function in the AProjectGameMode class instead of the event classes just fine:

 gameMode->test1();
 gameMode->test2();

I am just trying to get one, either, to work, included both because I am doing something that must effect both so thought it could be relevant.

Product Version: UE 4.11 Preview
Tags:
more ▼

asked Jan 15 '16 at 10:43 PM in C++ Programming

avatar image

HartLabs
26 2 4

avatar image HartLabs Jan 15 '16 at 11:24 PM

OK, so made some progress, I think the first two things weren't working because I thought the event would fire without a direct reference to the blueprint in question. Still not sure exactly what is going on there.

I used this tutorial to create a class derived from UUserWidget https://forums.unrealengine.com/showthread.php?38097-Tutorial-Extend-UUserWidget-for-UMG then implemented testCPPWidget() within that class.

 UFUNCTION(BlueprintImplementableEvent, Category = "Menu System", meta = (DisplayName = "C++ - Test Widget Thing"))
     void testCPPWidget();

Then I use the following code to call the function, where CurrentWidget is a pointer to a UUserWidget that is stored when a menu blueprint is brought forward as the active menu.

 UMyUserWidget *newWidget = dynamic_cast<UMyUserWidget*>(gameMode->CurrentWidget);
 newWidget->testCPPWidget();

So do you need to store a reference to the blueprint via BeginPlay automatically calling a function to be able to fire an event later? Would make some sense, but why is that not explained anywhere if that is true? I think I am still not understanding something here.

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

0 answers: sort voted first
Be the first one to answer this question
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