Blueprint Compile Error: Could not find a pin for the parameter __WorldContext

This error happens in the latest UE 4.8 preview and also latest in GitHub at the time of posting this bug report (May 21, 2015).

Calling functions that have an implicit WorldContextObject parameter (line trace, execute console command, etc) in a Blueprint function library will give a compile error about a missing __WorldContext pin.

Repo

  • Create Blueprint Function Library asset
  • Create two funcions, with the following graphs:

43601-graph1.png

43602-graph2.png

  • Compile & Save the Blueprint Function Library
  • In a level blueprint, create the following graph:

43603-graph3.png

  • Compile level blueprint

You will receive the following error on NewFunction_1 node:

Error Could not find a pin for the parameter __WorldContext of NewFunction_1 on New Function 1

Work Around

As a workaround, you can add a Get Player Controller node to the NewFunction_1 graph. This node does not need to be connected to anything, as in this example:

43604-graph4.png

Note, that you put the Get Player Controller node in the graphs of the Blueprint Function Library, not where call the functions. Placing this node in the graph tricks the Blueprint compiler into properly handling the implicit __WorldContext input to the Blueprint Library function. This Get Player Controller node won’t be executed at runtime (since it’s not connected), so there are no other side effects.

Fix

This pull request fixes the bug, and it also has detailed information about the specifics of the bug.

Notes

I’m pretty sure this is the same bug as mentioned in this bug report and likely addresses bug report UE-11185. In my testing, I did uncover a couple other cases that would give me a __WorldContext compile error but didn’t discover a reliable repo case. However, the fix and the workaround should work in those cases too.

Hello

I was able to reproduce this issue on our end. I have written up a report ( UE-16019) and I have submitted it to the developers for further consideration. I will provide updates with any pertinent information as it becomes available. Thank you for your time and information.

Make it a great day

Hi Lee,

Thank you for the awesome investigation!

The main problem is the possible circular dependency while detecting if a static function should have the WorldContext parameter. RemoveUnnecessaryAutoWorldContext was removed. All BP static functions will have the hidden WorldContext pin.

https://github.com/EpicGames/UnrealEngine/commit/1d39b9b457c0beb8d7f2671f54e538301ad0578e

Cheers,
M

Thanks the for the workaround. In 4.17.1 I still ran into this issue while calling a Blueprint Function Library function from another Blueprint Function Library. The issue was resolved by added an unconnected Get Player Controller as you stated.

Just wanted to note that after it worked, I deleted the Get Player Controller after and the issue did not return.

Running into this issue with UE5 Preview 2. Get Player Controller workaround does not appear to be working.

1 Like

I’m also running into this issue on release 5.0.2. So far none of the various workarounds have worked. have you had any luck?