I have a widget with buttons to select which level to load.
As this is repetitive code I would like to use a function. This function needs a input parameter referencing the map object.
From the Open Level (By Object Reference) function I can see there does exist a object type for this (World Soft Object Reference), however I am unable to specify this object type as a parameter?
Currently I am getting around this by keeping this object type as a global variable in the widget, and then referring to it in my function, however it doesn’t feel to be best practice.
I originally thought this was possible without resorting to C++ but I’m quite certain now that it’s not. I imagine the devs have their reasons for not exposing UWorld to blueprints. In any case, you need to resort to C++ to expose the TSoftObjectPtr<UWorld> type. The upside is that you can use it, for example, in structs and it will add the asset picker to it for you.
I believe I found a workaround. In 5.8, as of today, you indeed still can not find the World type in My Blueprint tab to set the variable type. But if you drag the pin out of one of the functions using this type, you can use the Promote to variable functionality to create a variable of this type. And since there absolutely ARE functions working with this type accessible in blueprints, I believe it’s rather a bug, to not have the option to create it from the My Blueprint, than an intended way to obscure this possibility from the blueprint based devs.