Announcement

Collapse
No announcement yet.

I Need Help With BPI Communication

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

    I Need Help With BPI Communication

    I've been using BPI's, but not to it's full extent. How do I pass in an actor reference that can be used elsewhere? Lets say I have an Actor BP called MyActorBP with a boolean bActive and I want to pass the Actor, MyActorBP through the BPI so that I can read the boolean, bActive in another BP (like a UMG HUD).

    I've tried putting the BPI on the UMG and MyActorBP:
    1st try: setting an event on MyActorBP, calling function on UMG
    2nd try: setting an event on the UMG and calling function on MyActorBP

    I've tried putting the BPI on just one (MyActorBP or UMG)
    tried both: setting an event on one, calling message on the other

    Each time the UMG is reading NONE as the passed in actor so help would be appreciated and thanks in advance!

    #2
    Originally posted by Zombicide-II View Post
    I've been using BPI's, but not to it's full extent. How do I pass in an actor reference that can be used elsewhere? Lets say I have an Actor BP called MyActorBP with a boolean bActive and I want to pass the Actor, MyActorBP through the BPI so that I can read the boolean, bActive in another BP (like a UMG HUD).

    I've tried putting the BPI on the UMG and MyActorBP:
    1st try: setting an event on MyActorBP, calling function on UMG
    2nd try: setting an event on the UMG and calling function on MyActorBP

    I've tried putting the BPI on just one (MyActorBP or UMG)
    tried both: setting an event on one, calling message on the other

    Each time the UMG is reading NONE as the passed in actor so help would be appreciated and thanks in advance!
    It might be easier to figure out the issue if you could share a screenshot of the UMG function. When its called from the actor as well as the implementation in the UMG blueprint.
    Unreal Possibilities
    Wave Spawning System | Tower Defense Starter Kit | Floating Damage Texts

    Comment


      #3
      Originally posted by Stormrage256 View Post

      It might be easier to figure out the issue if you could share a screenshot of the UMG function. When its called from the actor as well as the implementation in the UMG blueprint.
      I feel like it is not really needed to supply a picture...

      It's just a UMG with a horizontal box and 2 text fields and a bare overlap event on MyActorBP (just trying to pass MyActorBP info into the HUD to get the bool to show on the HUD)
      left text: is Active?
      right text: (meant to show true / false of boolean)

      I can access and update the text easily if I created the HUD on MyActorBP, but I am trying to create a more dynamic HUD to pass any info into.
      The HUD is created in a different Actor BP, let's call it MyHUD_BP, which is placed in the world and on begin play the HUD is created. If I want to get the info of MyActorBP to update text fields on the UMG on begin overlap of a trigger, how do I set up the BPI and functions?

      Does the BPI function have an input or output or none?
      Do I call the BPI event (BPI function) on MyActorBP, myHUD_BP or the UMG?
      Do I call BPI function on MyActorBP, MyHUD_BP or the UMG?
      Do I call an interface call to the BPI event on MyActorBP, MyHUD_BP or the UMG?
      Do I not place the BPI on either MyActorBP or the UMG or both?
      Do I use a message call to the BPI on MyActorBP or the UMG?

      If you still absolutely need a picture, I can try to provide a few. There are just a bunch of variations to set it up and it not work apparently...

      Comment


        #4
        Well, I generally store a reference to my main viewport widget in the HUD class. This way, anytime you want to make a HUD update, you can use Get Player Controller >> Get HUD, then cast it to your HUD type, and tell it to update the viewport widget. So unless you have different HUD classes for each level, there is no need to implement an interface.
        Unreal Possibilities
        Wave Spawning System | Tower Defense Starter Kit | Floating Damage Texts

        Comment


          #5
          Originally posted by Stormrage256 View Post
          Well, I generally store a reference to my main viewport widget in the HUD class. This way, anytime you want to make a HUD update, you can use Get Player Controller >> Get HUD, then cast it to your HUD type, and tell it to update the viewport widget. So unless you have different HUD classes for each level, there is no need to implement an interface.
          This is not the "main" widget of the player. The BPI is to get any info, so that I or another can create a widget for it. Each level uses the same player HUD, what I'm doing is just an Actor BP placed in the world to show an overlay HUD on top of/under the main HUD.

          Comment


            #6
            Originally posted by Zombicide-II View Post

            This is not the "main" widget of the player. The BPI is to get any info, so that I or another can create a widget for it. Each level uses the same player HUD, what I'm doing is just an Actor BP placed in the world to show an overlay HUD on top of/under the main HUD.
            So in the BPI:

            Click image for larger version

Name:	BPI.JPG
Views:	99
Size:	147.0 KB
ID:	1775747

            In the actor:

            Click image for larger version

Name:	actor.JPG
Views:	95
Size:	71.2 KB
ID:	1775748

            In the widget:

            Click image for larger version

Name:	widget.JPG
Views:	88
Size:	51.5 KB
ID:	1775749

            Check out Zof ( puzzle game ) on Steam:

            https://store.steampowered.com/app/1414480/Zof/

            Comment


              #7
              Originally posted by Zombicide-II View Post

              This is not the "main" widget of the player. The BPI is to get any info, so that I or another can create a widget for it. Each level uses the same player HUD, what I'm doing is just an Actor BP placed in the world to show an overlay HUD on top of/under the main HUD.
              It doesn't have to be the main widget. For example, let's say you have an information panel that is being added on to the main viewport only when you focus on specific actors. The HUD class can have an event say "OnActorFocused", which when called will tell the view port widget (since it already has a reference) to display the information panel, whether it be creating a new widget, or making it visible/hidden at runtime.

              This way only the HUD class handles UI updates. The actors do not have to know or keep track of widgets, nor do the widgets need to know who they belong to.
              Last edited by Stormrage256; 06-14-2020, 07:38 AM.
              Unreal Possibilities
              Wave Spawning System | Tower Defense Starter Kit | Floating Damage Texts

              Comment


                #8
                Originally posted by Stormrage256 View Post

                It doesn't have to be the main widget. For example, let's say you have an information panel that is being added on to the main viewport only when you focus on specific actors. The HUD class can have an event say "OnActorFocused", which when called will tell the view port widget (since it already has a reference) to display the information panel, whether it be creating a new widget, or making it visible/hidden at runtime.

                This way only the HUD class handles UI updates. The actors do not have to know or keep track of widgets, nor do the widgets need to know who they belong to.
                My UMG widgets are individualized and need to know who/what they reference. Rather specific information about those Actors. They are non-generalized and aren't meant for ANY Actor.

                If I placed the Info HUD on the Main HUD BP, how do I constantly update text for an individual widget that is meant to reference a specific actor?

                this would only apply as a do once and return none without an actor reference passed in
                Info HUD REF >> WidgetIndividual1 >> Update Actor Info Text

                Comment


                  #9
                  Originally posted by ClockworkOcean View Post

                  So in the BPI:

                  Click image for larger version

Name:	BPI.JPG
Views:	99
Size:	147.0 KB
ID:	1775747

                  In the actor:

                  Click image for larger version

Name:	actor.JPG
Views:	95
Size:	71.2 KB
ID:	1775748

                  In the widget:

                  Click image for larger version

Name:	widget.JPG
Views:	88
Size:	51.5 KB
ID:	1775749
                  This worked. Thank you. Are any of the Get All nodes expensive as far as performance? Like if I was to use the Get All Widgets on a Tick event (to update text constantly), would it affect performance?

                  Comment


                    #10
                    Originally posted by Zombicide-II View Post

                    This worked. Thank you. Are any of the Get All nodes expensive as far as performance? Like if I was to use the Get All Widgets on a Tick event (to update text constantly), would it affect performance?
                    Get all on tick is ok if you have small number of whatever you're getting, like < 10.

                    But if you want the widget to constantly reflect the status of a variable somewhere else ( like in the player for instance ), you just have to do that in the bind. Then it happens automatically.

                    Here's an example:

                    https://www.youtube.com/watch?v=qzcqmVcV9IQ
                    Check out Zof ( puzzle game ) on Steam:

                    https://store.steampowered.com/app/1414480/Zof/

                    Comment


                      #11
                      Originally posted by Zombicide-II View Post

                      My UMG widgets are individualized and need to know who/what they reference. Rather specific information about those Actors. They are non-generalized and aren't meant for ANY Actor.

                      If I placed the Info HUD on the Main HUD BP, how do I constantly update text for an individual widget that is meant to reference a specific actor?

                      this would only apply as a do once and return none without an actor reference passed in
                      Info HUD REF >> WidgetIndividual1 >> Update Actor Info Text
                      Well, that can be easily done by passing the information through the event as parameters. When the actor's state is changed, you can call the event with the updated parameters. So it doesn't really matter if it's being called only once or several times. Instead of binding the widgets to actors, you essentially get a more event driven workflow where widgets are updated only when certain events happen.
                      Unreal Possibilities
                      Wave Spawning System | Tower Defense Starter Kit | Floating Damage Texts

                      Comment


                        #12
                        Originally posted by ClockworkOcean View Post

                        Get all on tick is ok if you have small number of whatever you're getting, like < 10.

                        But if you want the widget to constantly reflect the status of a variable somewhere else ( like in the player for instance ), you just have to do that in the bind. Then it happens automatically.

                        Here's an example:

                        https://www.youtube.com/watch?v=qzcqmVcV9IQ
                        Let's say I have a location variable that I want to update constantly as text, I pass in a reference of the Actor. I can bind the text to the variable or I can set text with a tick. If the widget already has the info and reference to update, isn't a bind similar to a tick?

                        Comment


                          #13
                          Originally posted by Stormrage256 View Post

                          Well, that can be easily done by passing the information through the event as parameters. When the actor's state is changed, you can call the event with the updated parameters. So it doesn't really matter if it's being called only once or several times. Instead of binding the widgets to actors, you essentially get a more event driven workflow where widgets are updated only when certain events happen.
                          Ok, that makes sense. I may have to try something with that and see what I come up with.

                          Comment

                          Working...
                          X