Getting newly created assets from UObjectLibrary in commandlet
I am working on automating a process which creates a bunch of maps and spawns actors in sublevels via commandlet. I am currently having trouble getting a list of packages that have been newly created via UObjectLibrary.
Currently I am creating new world asset and registering it with the AssetRegistryModule using the following code:
Then I save the packages to disk using a call to GEditor->SavePackage() for all dirty packages. I am then attempting to retrieve a list of the created levels using the following code:
This works, returning the UWorld packages at the specified path, but only after the commandlet process has run to completion. If that function is called during the same run the ObjectLibrary is not populated and no packages are retrieved by ObjectLibrary->LoadAssetDataFromPath(Path).
If the above function is called during the same run the UWorld packages are created, no results are returned.
If the above function is called during a subsequent run the expected results are returned.
I am wondering if I am missing some step in the asset creation and registry process which would allow me to retrieve the packages via path using UObjectLibrary, or if there is a better way to create/retrieve packages for immediate use in a commandlet.
asked Apr 24 '18 at 12:40 AM in C++ Programming
I have figured this out, the important was to set UObjectLibrary->bIncludeOnlyOnDiskAssets = false to get it to collect the newly created assets as well.
I have also changed to a slightly different method to create the levels; Using UWorldFactory to generate the world.
Follow this question
Once you sign in you will be able to subscribe for any updates here