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:
- Compile & Save the Blueprint Function Library
- In a level blueprint, create the following graph:
- 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:
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.