I’ve noticed that when I call function inside of another function that is also created in same BPFL, World Context Object Reference input pin will appear on the node. This pin doesn’t need to be plugged and all the functions will compile without any errors or even warnings.
I’ve searched for the answear but I wasn’t able to find any. I’ve found only UE-39873 bug ticket which exacly describes this behavior and pull request 8016 that would fix it but It has been resolved as ‘Won’t fix’ without any reason given.
You can even quickly reproduce it by following these steps:
Create blank UE project and open Editor
Create new Blueprint Function Library
Create new function inside of Blueprint Function Library
Call the same function inside of it’s own body
World Context Object Reference input pin should appear on function node
(UE5.0.3 / Epic Launcher version)
So my question is:
Why does World Context pin appear in this specific case and what is the purpose of using it?
Thats nothing you should worry about (if gives you an error just connect it with the world context variable).
But basicly, every function that comes from a function library (not from an actor), needs to have a reference in the world to be executed. That’s why it appears, when you call a function from a class that comes from the the class actor it will assume that the world context is the actor itself, that’s why it not appears in characters and actors, it still there but it just not visible.
It’s been a while, I would like to add a more information. In BlueprintFunctionLibrary function, you can get world context by just clicking right mouse button and search for world context. It will return a world context passed from caller(Actor, ActorComponent, etc).
You can use this value to get world and other world relative objects like PlayerController or call other BlueprintFunctionLibrary functions.