How to get the current world from a blueprint?

So GetWorld() can be called in C++ for any UObject, but is there an equivalent in blueprint? I have some functions which take the world as an argument that I need to use but I can’t find a way to get a reference to it.

It’s a static function i wrote in C++ that needs the world

Generally, what is done is too pass a Uobject* as a first parameter named “WorldContextObject”, from which you can do “Getworld”. You can improve your flow in blueprints to pass automatically this Uobject, by doing :
UFUNCTION(BlueprintCallable, meta = (WorldContext=“WorldContextObject”))
static void MyFunction(UObject* WorldContextObject,…)
This is what is used from most of blueprint libraries in UE4. See GameplayStatics.h or KismetSystemLibrary.h for more examples.

1 Like

Dude, thanks a lot!