can you call functions from within function libraries

hi

can you call functions from within function libraries
when i do it creates a world context variable that i am not sure about

thanks

Hey there @barbrian0723! Yes you can call blueprint library functions directly. The “world context” requested in them is often able to be left out, as world context is just there to ascertain where in the game it’s being called from/to. Since Blueprint Function Libraries are Static they are accessible from anywhere, but have no frame of reference in which world to interact with, unless implicitly or explicitly told. For example if you make a common function that you call from your Character BP, it provides the world context naturally as it itself is in the world. However, if it’s called by something outside of the currently active scene, you’ll need to pass in a reference to that scene so the function knows it’s scope.

Disclaimer: One or more of these links are unaffiliated with Epic Games. Epic Games is not liable for anything that may occur outside of this Unreal Engine domain. Please exercise your best judgment when following links outside of the forums.

1 Like

lol

i think i am ok so that i dont need to look into function libraries much more

just was not too sure about calling function libraries from within function libraries and the world context popping up

i use function libraries a lot, but this is the first time i am using function libraries and having the library function call another library funct

thanks

Ahhh gotcha, I’m not certain if the implicit world context would transfer between the two actually, and now I have something to test, but you could for sure pass along any explicit world context through the inputs and outputs if needed for sure.

i will see what happens when i start to debug the new function

Great! From my quick test, it does seem that the implicit world context from the first is passed to the second, as long as it originated from an object with world context.

what is world context
can you provide an example perhaps
what would and what would not provide/ have world context

In Unreal, there can be multiple worlds operating at once, as well as objects outside of them. Static objects (or static functions in your case) don’t exist inside of a world itself, and require context as to which world it is operating on. World context is just information to tell an object what it has access to and what world it is interacting within.

The nodes for them only appear in situations where you may need to provide it explicitly if there is no implicit context given. If you call one of the functions in the library from any object within a world, that data is automatically passed along as the world context implicitly.

Though if there is no implicit context, you can pass in any reference to any object within an active world to the world context node, it will know which world it is meant to operate in.

1 Like

have just finished the function and debugged it
had no problems and did not had to set world context

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.