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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

C++ function switches parameters and outputs in blueprints

As the title says, I have a function written in C++ like so UFUNCTION(BlueprintCallable, Category = Enemy) void ProcessTrace(FHitResult& Impact) but when I try to call it inside Blueprints, the node has reversed the input and output and this is what I get:

alt text

Can someone explain why this is happening?

Product Version: Not Selected
Tags:
function.png (18.7 kB)
more ▼

asked Mar 05 '15 at 07:17 AM in Blueprint Scripting

avatar image

Swiftle
109 19 26 32

avatar image Spiris Mar 05 '15 at 07:38 AM

I can't really test this myself, but could it be that the keyword 'const' prior to FHitResult fixes this issue?

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

2 answers: sort voted first

You've specified an out parameter. Change it to (const FHitResult& Impact).

References are treated as output parameters by the engine. Marking it const (constant) prohibits modification, and the engine will treat them as input parameters.

more ▼

answered Mar 05 '15 at 01:38 PM

avatar image

MulleDK19
2.7k 161 274 254

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

The reason is because my function takes a reference to a FHitResult. I declared another function like this:

void ProcessTrace(FHitResult Impact) (no &) and it appears correctly in blueprints.

more ▼

answered Mar 05 '15 at 07:41 AM

avatar image

Swiftle
109 19 26 32

avatar image Spiris Mar 05 '15 at 07:55 AM

You should be able to pass things in by reference without them being forced to out, but it is good that you have it working. I have tested using the 'const' keyword and it allows for passing in objects by reference. My c++ is bad, so I can't really explain this, but hopefully someone else will be able to better explain it.

(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