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 Delegates and Event Calls

Overview

I have a C++ event system running in the background. You bind events to the system based on a type. When events are called they are called by the type so only listeners of that type get called.

Now I've created a dummy class. To help with assignment in blueprints.

Function

When in a blueprint you bind to events by calling "Bind Event" as seen in the image.

It returns a dummy class inheriting UObject that binds itself to the event system based on the type you pass in.

The returned object has a DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam that is BlueprintAssignable and you assign it the blueprint. This allows you to handle each call back in a unique way.

So far so good.

Issue

As seen in the image, binding an event to the OnEventCalled works just fine.

However, if I store the reference to the object in a variable and try to access the event OnEventCalled (Event Listener) separately. It does not work.

However this works on other things like components, lights and actors. Is this simply impossible or am I doing something wrong.

alt text

Product Version: Not Selected
Tags:
eventsys.jpg (411.6 kB)
more ▼

asked Apr 03 '15 at 12:36 AM in C++ Programming

avatar image

Mercurial Forge
99 13 17 18

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

1 answer: sort voted first

When you add the event call for event listener, it created based on the default value of object, which it's null at that time, and at BeginPlay you assign another object which not same as old one so when you call it only execute whatever bind after that, what you experience is 2 event of 2 different object, Component work because they added in constructor.

more ▼

answered Apr 03 '15 at 03:17 AM

avatar image

Duncan Dam
3.1k 121 50 164

avatar image Mercurial Forge Apr 03 '15 at 04:36 AM

This completely makes sense!

I'm listening to an event on the null variable. Once the game starts I fill it, but the listener I created in the blueprint is still null, it's never updated. And you can't. But when I assign an event to the newly created object, that works just fine.

Components on the other hand, work because they are generated during the constructor phase, and thus are being assigned to valid objects.

(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