x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Force blueprint function override as function instead of event

I've written a function in c++ that takes a struct reference as an input, with the intent to modify values inside the struct.

 UFUNCTION(BlueprintImplementableEvent, Category = Buff)
 void OnBuffStart(UPARAM(ref) FBuff& oBuff);

The issue is that since the function has no output, attempting to override the function in a blueprint creates an event instead of a function. Using an event for this causes a warning, "No value will be returned by reference. Parameter 'oBuff'."

Is there a tag to force a function with no output to be overridden as a blueprint function?

Currently a workaround is to add an output to the c++ declaration, override it in the blueprint as a function, then remove the output parameter.

Product Version: UE 4.9
Tags:
more ▼

asked Oct 29 '15 at 04:55 AM in Blueprint Scripting

avatar image

Empio
11 1 1 1

avatar image FakeEnema Aug 16 '16 at 11:52 PM

Good god, yes please. I want to use local variables, so I want my overridden functions to actually be functions. It seems dumb that I have to make an extra function to call into from the overriden event in my BP just so I can have local variables and a clean graph.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Good news - I've just added a metadata option to the build we use for GroundBranch to do just this.

     UFUNCTION(Category = "AI|Director", BlueprintNativeEvent, Meta = (ForceAsFunction))
     void SetInitialBehaviour(class AGBAIController* AIController, const TArray<FAIInitialBehaviour>& InitialBehaviours);
     void SetInitialBehaviour_Implementation(class AGBAIController* AIController, const TArray<FAIInitialBehaviour>& InitialBehaviours);

alt text

Guess I'll see about creating PR.

more ▼

answered Sep 02 '16 at 05:09 AM

avatar image

Kris
559 19 22 34

avatar image Wallby Mar 12 '19 at 01:09 PM

Did you ever share that feature anywhere public?

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question