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 Interface not working with UMG

I thought I knew how to use a Blueprint Interface but apparently not. I've got a main widget with a child widget of a search field.

I created an interface with a function called FirstNameSearchCommitted then inside my search field widget I add the interface and then call the FirstNameSearchCommitted function with an interface call.

alt text

Inside my parent widget, I create the event for FirstNameSearchCommitted and run a simple print string but it never fires.

alt text

I've noticed that the target pin for the interface call is a faded yellow/green which I've never seen before (normally it's blue) but I can't seem to plug anything into the target slot so I just left it as self, which I thought would work.

Anyone know what I'm doing wrong?

How else would you communicate with a parent widget from within the child if you don't always know what the parent will be?


Product Version: UE 4.21
more ▼

asked Jun 12 '19 at 12:35 AM in Blueprint Scripting

avatar image

1.2k 87 116 146

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

1 answer: sort voted first

You do need a target for it. If the child widget implements the interface, then place a reference to the child widget and pull off from there to create the FirstNameSearchCommited node.

more ▼

answered Jun 12 '19 at 06:33 AM

avatar image

274 4 9 12

avatar image TorQueMoD Jun 12 '19 at 06:41 AM

Hey, thanks for replying. Oh, that's why I wasn't able to call the function correctly, I implemented the interface in both widgets :P Okay so I updated to only implement the BPI inside the parent widget now and then for the target in the child I used a GetParent node but this isn't working. Aside from using a GetAllActorsOfClass, how can you reference the parent widget inside another widget that doesn't yet know it's a child? I've tested it with the GetAllActorsOfClass node and it works now, but I don't want to have to use that because I'd like to be able to have multiple instances of the actor in a scene to make this more dynamic and re-useable.

avatar image dachora1 Jun 14 '19 at 06:20 AM

How do these widgets get created? If the parent widget creates the child widget, then it can also give the child a reference to it. This way, the two both have a reference to each other and can call the other's public functions, no interface needed.

An interface is generally useful when you don't know the type of the object you're calling on, as it could be one of many. But this sounds like you only want to link the two, and that they always come in pairs like this. So I would get rid of the interface and give them references to each other for a simpler, more direct method.

avatar image TorQueMoD Jun 14 '19 at 08:48 AM

What I was doing was I created several elements of my HUD as standalone widgets so that they could be re-used as I needed. So inside the Parent Widget, I simply added the other child widgets to the canvas but I realized with buttons inside a child widget, for example, I couldn't affect elements that were specific to the parent widget because the child has no idea that the parent exists. So if I place some text inside the parent widget and then I want to change the text on a button press inside the child widget, I have no idea how to code it. Should I just create a reference variable of the parent inside each of the child widgets? Is that how it's done? Yeah, that would probably work. I think I was just too tired to figure that out the other night :P

(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