I am setting up a pipeline for assigning maps unique ids, but I cannot find a good way of renaming a map without loosing built data. I have tried a number of different approaches:
- The operation I am looking for is possible through drag and drop in the content editor, but I have not figured out how I can use these same functions from a commandlet or similar.
- EditorAssetLibrary.rename_directory() and similar works for other assets, but not for maps nor built data. Throws The AssetData ā%sā is not accessible because it is of type Map/Level
- AssetTools.duplicate_asset() works for levels, but discards the reference to built data. I could in theory use the resavepackages -buildlighting commandlet to rebuild data, but it would obviously be a terrible waste of resources. Also, the commandlet seems to not work on Mac, which is used to cook for ios. Using an extra server to process building would be an even worse workaround.
- Console command OBJ RENAME OLDPACKAGE=/Game/FirstPersonBP/Maps/FirstPersonExampleMap OLDNAME=FirstPersonExampleMap NEWPACKAGE=/Game/FirstPersonBP/Maps/FirstPersonExampleMap2 NEWNAME=FirstPersonExampleMap2 . Crashes the editor immediately. Am I calling it wrong?
- Reading the raw .umap/.uasset file, I can find and edit the strings I need, but there seems to be a lot of byte offset values I would also have to adjust to not corrupt the file. A clear reference of the .umap/.uasset structure would have been helpful, but I cannot seem to find this in the source code.
I can go 99% of the way with the solutions above, but really need some input on how to accomplish that last 1%.