Automatic value passing into disconnected input pins under weird circumstances

Leaving an input pin empty for a parameter of an object type usually passes a null value. (Like in the comparison in StandardMacro “IsValid”.)
However, when calling a function from a blueprint instance where a parameter is of that blueprint instance type and its input pin is left disconnected, the calling instance (self) is automatically passed as the value instead of null.
This behavior seems to be undocumented and is possibly a bug. (It sure was hell to debug.)


Here is an example that reproduces the problem:

Blueprint “FunctionCaller” calls “Test Function” of another Actor and leaves the pin for “Instance” empty. “Instance” is of type FunctionCaller_C.
Blueprint “FunctionProvider” has the called function and expects “None” as the value of “Instance”, but instead its value is the calling instance of FunctionCaller.

First encountered in 4.1, still occurring in 4.2.1

Edit:
Additional info that may help to reproduce it

  • The parent class of both BPs is Actor.
  • One instance of each BP is spawned in the level blueprint on Begin Play (first “provider”, then “caller”)
  • Immediately afterwards, „Call Test Function“ is called on the instance of FunctionCaller, passing the instance of FunctionProvider.
  • For me, this causes the Print String message to show because for some reason, the instance of FunctionCaller is in the parameter instead of it being null, as I expected.

A zipped project that reproduces the problem for me (and two others who verified it for me) is attached.

Hi ,

Unfortunately I am a bit confused as to what you are looking for. I tried recreating this and received a null value from the branch, which is, from my perspective, what was intended. The instance = null and you are checking against null, which should return a false value. Could you walk me through your exact reproduction steps as well as the intended functionality so I may better understand what to look for? Thank you!

Hey ,

it is very likely that I haven’t identified all required reproduction steps. I added more info to the description and attached a minimal demo project that exhibits the error on my machine/installation. Thank you!

Did you see the info and the download that I added? I call the function from the Begin Play event in my level blueprint, directly after spawning the two blueprints there. In your example screenshot, I think you should pass an instance of Function Provider.

I completely understand why the condition evaluates to true when the Instance input has a value. I don’t understand where the value comes from. Why is there a value in Instance in the first place? Look at where it’s called: in Call Test Function, the Instance pin is left unwired.

because your instance input is looking for a functioncaller

Does that mean that unwired pins fill themselves with fitting data automatically under some circumstances? Is that a feature? Is it explained somewhere?

It starts off as none until the functioncaller is passed in

Why and where is the functioncaller passed in? Just because it happens to have a type that matches the parameter? Is this documented somewhere?

Try promoting the instance to a variable and leave said variable at none, see if that helps.

I’m not trying to solve a specific problem (I already found a workaround for my code), I just want to report this as what appears to me to be very odd behavior. I just want to make sure you’re aware of the issue and to know whether this is a bug or by intention. If you’re telling me that this is just one of the quirks of Blueprint, that’d be enough for me. Thank you for your time, btw. :slight_smile:

Hi Person,

I tried a second time, however I was still able to get the function to work as intended. How is your event graph set up? I set up an event tick to simply call the second function and it returns a null value as intended.

After testing your files, we discovered that the reason it is returning true is because your instance input is looking for a functioncaller, and that is being passed into your target node. Effectively, it is returning as true because you are passing the very thing that Instance is looking for into the function. To test this, use a to string node from your instance input on the Function Provider blueprint and attach this directly to your print string, you will see exactly why it is registering true instead of false.

Effectively the input is accepting whatever data is passed through the entire function, in lieu of having a specific set of data that you chose. It starts off as none until the functioncaller is passed in, then it accepts the instance of function caller because you have not told it to take in anything else. If you placed a specific variable into that space it would accept whatever the instance of that variable was instead of the functioncaller’s instance, though functioncaller would still be passed through. Try promoting the instance to a variable and leave said variable at none, see if that helps.

I understand, this is intended functionality. I am happy to hear you found a workaround for your code. Have a great day!

Hi Person,

I don’t believe it is fully documented, I will pass this information along for consideration!

Alright, that’ll do. :wink: But would you mind to also answer one of my previous questions, namely if and where this “automatic value passing into disconnected input pins” is documented? I can live with “it’s not”, I’d just like any kind of answer to that. The behavior is odd enough to deserve being mentioned somewhere. Have a great day, too!