Announcement

Collapse
No announcement yet.

Unexpected Event Behavior in Widget BP

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Unexpected Event Behavior in Widget BP

    I have a few different dialogs in my game. I am having an issue with 2 of them that I use as generic dialogs. One has just an OK button and the other has an OK and a Cancel button. I have an additional event dispatcher in each so I can provide custom behavior if needed. It all works fine except for in some rare occurrences, the dialog is called 2 times in a row. And when its called 2 times in a row the event dispatcher is only called the first time.

    Its a farkle game so for example if the player farkles I will show a single button dialog telling the user they farkled and their turn is over. The game then runs through 3 CPU player turns and then passed control back to the user when the CPU players are finished. When the CPU players are done I show a notification that it is now the players turn and then roll the dice automatically to start. If that first roll results in a farkle, when the player hits the ok button this time nothing happens. I placed a debugger and the event is not being called. So I have a feeling it has something to do with how I am using it. I could always try and not roll the dice automatically the first time when its the players turn again but I'd like to find out what is going on here.

    Here is the show function of the dialog. I call it when I need to show a dialog with one button.
    Click image for larger version

Name:	ShowFunction.png
Views:	1
Size:	69.9 KB
ID:	1225030

    Here is the event that is called in the dialog when the ok button is pressed. This is called both times the dialog is opened. No issues here.
    Click image for larger version

Name:	OkClicked.png
Views:	1
Size:	275.6 KB
ID:	1225031

    Here is a spot where I show it. The PlayerFarkled event is only called the first time.
    Click image for larger version

Name:	ShowDialog.png
Views:	1
Size:	96.3 KB
ID:	1225032

    Any ideas on what might be causing the problem?
    Last edited by jman2015; 07-07-2017, 11:13 PM.
    HunterGaming
    Facebook
    Twitter

    #2
    Guessing.

    What happens if you plug a target widget into the "Add to viewport" node (or self)? Or try to make the function an event.
    Last edited by unit23; 07-08-2017, 02:39 AM.
    [LEGENDS of EPICA]

    Comment


      #3
      I just tried both connecting "add to viewport" to self and making the show function an event. Doesn't seem to change anything.
      HunterGaming
      Facebook
      Twitter

      Comment


        #4
        I don't think this is the problem but sometimes if a function doesn't have a return node it acts up even if there's no values being returned also you could do an is valid check before adding it the viewport because widget never get destroyed

        Comment


          #5
          Adding the return node and an is valid check didn't seem to have any effect. I had the IsValid node checking "Self" so it was checking the dialog right before calling "Add to Viewport".
          HunterGaming
          Facebook
          Twitter

          Comment

          Working...
          X