Download

Event BeginPlay won't let me call WidgetHud

Hi all,

I’m having, what I believe is a weird issue, unless there is something basic I have no idea of.

So I have a ‘Function’ in my Pawn Controller, where you click on a table (or touch with the finger) and if the Object Type of that object is “Furniture” then it will call a menu, one that pulls the name of the object, and has a “Delete” button in order to delete the object from the level.

I’ve haven’t had any trouble with it until now…

I added a different code to some of the tables, so they will spawn with a chair. as soon as I add an Event BeginPlay inside the objects BP that widget won’t get called. It will still see the Object Type of the object hit, and also compare it with the “Furniture” one and print the name of the object.But after that, it will not call the widget.

I’ve tried disconnecting the Event BeginPlay so the rest of the code won’t run, but the problem persist, so I tried adding JUST the Event BeginPlay to a different object, which was working fine. and as soon as I added, even without any extra code, the widget won’t get called… If I deleted, well you can guess… it works perfectly.

Not sure what is it, what am I doing wrong, or if there is anything I have to do when using the Event BeginPlay if I want to interact between BPs??

Please help!

Thank you in advance
Best Regards!

Edit: *Forgot to say, I know the best solution probably would be to add the code to the master furniture bp, but I haven’t been able to make it work from the master, so I still have to work with it a bit more. In the meantime I have a due date coming up soon, and I need the chairs to spawn as well, so I need to make this one work and then work on the master one.

Still, I don’t feel like the Event BeginPlay should act like this, so I would still be grateful to know what is going on!

Thank you! *

Can you show the code?

Hi!

Sorry for the late response, this last couple of days have been a bit crazy…

Ok, here are the screen shots of the code.

This is the Pawn Controller, this is the Menu called when clicking on the mesh

This is what that menu it opens “InGame”

Simple enough, that menu will contain description of the object, details like measurements etc… But the important part right now, is the ‘Delete’ option.

This is what the code inside that same mesh I clicked for the menu looks like

As you can see there isn’t any code… but as soon as I try to add the BeginPlay… like this

This happens:

So, when I click on the mesh it will detect the name *as you can see on the Hud Code, that will only happen if the Mesh has the correct Object Type… and then it will call the menu.
*Sorry for the bad screenshot, it wouldn’t let me upload the original because of size, so I had to crop them

So I hope this images re enough, this really isn’t much, but that is the problem, its not like I did a crazy code. The menu works just fine on the other meshes I haven’t implemented the BeginPlay.

Hope you can help, and thank you in advance!

Best Regards

I’m guessing from your code and description, that somehow, when you make these changes, ‘floor menu’ becomes true.

That would stop the event, right?

I’m afraid I can’t see the code in the object, it’s too small. Maybe just zoom in a bit there…

Hi!

Thank you for your response! I completely forgot to send you the “Branch” code if the Floor menu is active… That is a different Menu to change the floor materials, but it only calls it if the click on hits an object with the Tag for the floor. and we would see the actual menu pop up… I’m still working on that one… The screenshot of the object I sent was to show that I have no code at all, and it works just fine, but as soon as I add a BeginPlay it stops working.

Here is the code for the floor menu

Either way, I added a Print Screen to the branch in the 'True" if Floor Menu is Active. And as expected, it is not, only when I actually call the menu up and then click on the table it gives me the print text.

Do you have any more ideas I can try??

For each furniture class I have a ‘Master BP’ I tried adding the BeginPlay there… and it behaves the same way… I honestly don’t understand it, in my thinking there isn’t any logical explanation to why would a BeginPlay would not allow a Widget to get called, even when the widget is being called from the controller and not the mesh itself.

Thank you

I forgot to send the rest of the code for calling the Hud…

Even though I have print strings and it never even gets to that point, I’ll share it.

Thank you

Ah, you using class inheritance?

When you put the begin play in, do you need a link to parent begin play? ( if you don’t, you’re basically cutting out the begin play from the parent )

You mean Child BP by Class Inheritance? i’m sorry if it’s a dumb question, but I don’t have that long using UE4.

I do have a MasterFurniture_BP which contains the Item Structure variable, from there it goes to each of the categories of furniture, and then from those I have each piece of furniture… I tried adding the BeginPlay to the individual furniture, and then to the Category one, both stop the calling of the widget.

I wanted to try it out on the Master_BP, but the categories differ too much from each other, and I’m not sure how to do it like that.

But, I have not tried to link any BeginPlay in any way… unless it does it by default when adding a BeginPlay to a child BP. It sounds familiar ‘link to parent BeginPlay’ I think I saw the term in a video tutorial once. But have never implemented it myself.

Thank you again! sorry for the ignorance :confused:

Best Regards

NVM!!!
I went back at it, played around with the nods and found the one you are talking about!! I in fact did not add the link to the BeginPlay of the Master_BP, and now that I did it works correctly!!

Thank you very much I really appreciate the patience and also I also understand a lot more on the logic between Parent and Childs BPs!!

Best Regards!!

Excellent :slight_smile: