Announcement

Collapse
No announcement yet.

How property binding is working?

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

    How property binding is working?

    I mean how can I create my own property binding system in my custom blueprint? I want to bind a property value to function, in that function I can use other properties of blueprint. So when some property chanched all dependent properties will change too. I know that it realised in UMG and I can get sourse code... but may be some advices?

    #2
    Recent engine versions allows to do things like this:

    Code:
    private:
    
    UPROPERTY(EditAnywhere, BlueprintSetter = SetHealth, BlueprintGetter = GetHealth)
    
    float Health;
    
    
    public:
    
    UFUNCTION(BlueprintSetter)
    void SetHealth(float NewHealth);
    
    UFUNCTION(BlueprintGetter)
    float GetHealth();
    That will expose your custom function as a replacement to those "GET" or "SET" little nodes you see on Blueprint Graphs.
    | Savior | USQLite | FSM | Object Pool | Sound Occlusion | Property Transfer | Magic Nodes | MORE |

    Comment


      #3
      It's not what I want
      In UMG we can bind text on text widget, e.g. bind text to player health. If player health change then text on text widget will automatically change too. So I want to create this binding

      Comment


        #4
        I think what you want to look at is the PROPERTY_BINDING_IMPLEMENTATION macro. Look at TextBlock.cpp/h and see how the binding is setup. I never done it myself but it looks fairly simple.
        Joseph Wilcox
        [Technical Director] WisEngineering
        https://www.wisedrl.com

        Comment

        Working...
        X