Hello,
My MapLoader class takes in TAssetPtr<UWorld> references and streams in the maps when needed.
This works fine with UPROPERTY() TAssetPtr<UWorld> variables.
However, I would also like to load levels through paths. ("/Game/Maps/Test_Map")
Rather than load a pathed level directly, how would I get the TAssetPtr<UWorld> from a path so I can send it to my MapLoader?
Thanks!
Note: Everything I’ve seen online loads the levels immediately, while I only want to get the TAssetPtr>UWorld> of them.
TSoftObjectPtr<UWorld> you can convert to a path using builtin function ToSoftObjectPath() and you can also convert a SoftObjectPath back to a TSoftObjectPtr<>
But how can I make that conversion? Can’t find it.
Also how to convert from TSoftObjectPtr to TAssetPtr? Are they the same? Should I be using TSoftObjectPtr instead?
Yes but if that property were left empty, newMap->ToSoftObjectPath(); would cause a crash.
This is especially possible when dealing with hundreds of maps through an exposed array/tmap.
Would just be nice to know if the map is valid or not, though I guess it’s not possible without loading the map?