When function libraries need a reference of the world sometimes for some tasks…
for example get all actors with some tag…the function need to know the world where those actors are…or a delta time, etc.
There is a way to tell the library function to use the actor that is calling it as world context object so the world context pin does not appears in the blueprint node and is adding the meta WordlContext.
Example:
UFUNCTION(BlueprintCallable, BlueprintPure, Category = "My Blueprint Library" , DisplayName = "get delta seconds in a function", meta = (WorldContext = "WorldContext") )
static float GetDeltaSecs(const UObject* myWorldContext)
{
if (myWorldContext)
{
return myWorldContext->GetWorld()->GetDeltaSeconds();
}
else { return -1; }
}
Hope this helps!
Dany