Why World Context pin appears on function nodes called inside of Blueprint Function Library?

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:

  1. Create blank UE project and open Editor
  2. Create new Blueprint Function Library
  3. Create new function inside of Blueprint Function Library
  4. Call the same function inside of it’s own body
  5. 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?

Thanks in advance for any explanation!

This is a repost of my question from stackover flow
Alos probably related to “Blueprint Function Libraries and World Context?”

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.

1 Like

Thanks,
It solves whole confusion

also this explanation is a good one:

1 Like

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.

2 Likes