Announcement

Collapse
No announcement yet.

How to create a new custom delegate use for get a return value in blueprint just like FGetWidget?

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

    How to create a new custom delegate use for get a return value in blueprint just like FGetWidget?

    Hi,

    I'm creating a search box widget, and I want to make the user can bind a blueprint function with a match rule to check the typed text.

    So I should create a delegate with return value to the user can bind a customize blueprint function.

    Code:
    //I defined the delegate.
    
    DECLARE_DYNAMIC_DELEGATE_RetVal_TwoParams(bool, FOnMatchTypedText, const FString&, TypedText, const FString&, Suggestion);
    
    //And create a variable with the delegate.
    
    UPROPERTY(EditAnywhere, Category = Events)
            FOnMatchTypedText    OnMatchTypedText;
    But it can't bind any function in the blueprint.

    How do I create a custom delegate with return value like FGetWidget?

    #2
    Good morning,

    I think your are missing the BlueprintAssignable flag like in OnActorBeginOverlap

    Code:
    UPROPERTY(BlueprintAssignable, Category="Collision")
    FActorBeginOverlapSignature OnActorBeginOverlap;
    Have An Awesome And Productive Day
    Alex, Youtube Tutorials

    Comment


      #3
      Originally posted by AlexQuevillon View Post
      Good morning,

      I think your are missing the BlueprintAssignable flag like in OnActorBeginOverlap

      Code:
      UPROPERTY(BlueprintAssignable, Category="Collision")
      FActorBeginOverlapSignature OnActorBeginOverlap;
      I tried it, but if I used it, I'll get an error like BlueprintAssignable must use for multicast delegate.

      Comment


        #4
        That's the thing. If you want to be able to use the delegate like this in Blueprint it has to be multicast.
        Joseph Wilcox
        [Technical Director] WisEngineering
        https://www.wisengineering.com
        https://www.digitalleprechaun.com

        Comment


          #5
          I know, but the multicast delegate can't return a value for me.

          I want to get a return value from the delegate.

          Like MenuAnchor's OnGenerateContent delegate.

          Comment

          Working...
          X