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.
asked Aug 13 '17 at 01:44 AM in Blueprint Scripting
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.
answered Aug 13 '17 at 09:37 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here