Announcement

Collapse
No announcement yet.

UMG - Binding to variable vs binding to function

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

    UMG - Binding to variable vs binding to function

    I have recently been wondering if there are any real performance differences between binding a UMG item's value to a function vs binding it directly to a variable. I know that the function method will run the function every frame, which because of obvious reasons isn't the most performance efficient. But what about binding it directly to a variable?
    Marketplace Assets

    Advanced Mobile Input: Marketplace Page | Support Thread ――― Easy Input Remapping: Marketplace Page | Support Thread
    Multiplayer Blueprint Chat System: Marketplace Page | Support Thread ――― Closing Credits System: Marketplace Page | Support Thread
    Minesweeper Template: Marketplace Page | Support Thread ――― Maze Creator: Marketplace Page | Support Thread

    #2
    The thing is, you would use the function to calculate something. For example the percentage of a progressbar. Like CurrentHealth/MaxHealth.
    Even if you bind that progressbar to a variable, you would need to calculate the percentage somewhere.

    If you can use only a variable, like just displaying the CurrentHealth, then use a variable, but if you need to calculate something like above, then you might want to
    use a functionbinding. You can also check pointers etc in it and change values based on it. Making the Currenthealth to "N/A" when the Character is destroyed or something.
    Open for contracted work | C++/BP (incl. Multiplayer) | Tutoring | VR

    My UE4 Blog/Page with Tutorials and more: Hit me for ALL the things!
    (Including 100+ Pages Multiplayer Network Compendium to get you started.)

    Comment


      #3
      This has already been covered in another thread, https://forums.unrealengine.com/show...ce-differences

      Comment


        #4
        Originally posted by eXi View Post
        The thing is, you would use the function to calculate something. For example the percentage of a progressbar. Like CurrentHealth/MaxHealth.
        Even if you bind that progressbar to a variable, you would need to calculate the percentage somewhere.

        If you can use only a variable, like just displaying the CurrentHealth, then use a variable, but if you need to calculate something like above, then you might want to
        use a functionbinding. You can also check pointers etc in it and change values based on it. Making the Currenthealth to "N/A" when the Character is destroyed or something.
        Well, an example of how I might use either of them to do the same thing is if I have a tab, and when I click it I want it to switch to the active tab color, and set it to the inactive tab color when I click out of it. That could be done by using a 'Current Tab Color' that is variable-bound, and setting it, or it could be done by using a function, and a select color with a boolean.

        I am getting rid of my bindings all together. I am working on a chat system, and each message has the username and message text bound to a variable. With 1000 messages in the chat box, I was getting an FPS of ~28. After removing the bindings and setting the values directly, I was getting ~39 FPS with 1000 messages.
        Marketplace Assets

        Advanced Mobile Input: Marketplace Page | Support Thread ――― Easy Input Remapping: Marketplace Page | Support Thread
        Multiplayer Blueprint Chat System: Marketplace Page | Support Thread ――― Closing Credits System: Marketplace Page | Support Thread
        Minesweeper Template: Marketplace Page | Support Thread ――― Maze Creator: Marketplace Page | Support Thread

        Comment


          #5
          Originally posted by Jamendxman3 View Post
          I am getting rid of my bindings all together. I am working on a chat system, and each message has the username and message text bound to a variable. With 1000 messages in the chat box, I was getting an FPS of ~28. After removing the bindings and setting the values directly, I was getting ~39 FPS with 1000 messages.
          You should definitely never use bindings for static data.

          Comment

          Working...
          X