I’m curious if there is a way to generate a lot of uasset files automatically for my project? Ideally this would be a commandlet or a button I can create on the editor to do this (I have no intention of doing this at runtime in the game!)
Basically, I have a lot of translated dialogue data and audio files (thousands) that are supplied to me as audio files and with a nice JSON object of who is saying each line and the text etc.
I’d quite like to automate importing the audio files, then creating a series of DialogueWave objects with data filled in based on the JSON file I supply (the correct Dialogue Voice speaker etc.).
Ideally, I’d run UE4-EditorCmd.exe -run=MyAutoGenCommandlet -input=MyDialogueDatabase.json (or something) to create all the DialogueWave assets automatically, then our build system could commit all the new DialogueWave files ready for the team to use. I’ve been going through the documentation trying to work out how to create uassets and write them to the content browser/disk, but not had any luck.
You would have an actor or component that has a variable UMyClass* Asset; or something along those lines, then you can expose to BP and select the asset originally imported. Or you could do a LoadObject( NULL, TEXT( “/Game/SomePackageLocation/NewAssetName” ) ); (Pointing to the location of the created asset from above) during PostLoad of the actor
Thanks so much for your reply.
But, so, now I could only create new uasset for object in Content Browser of Unreal (like path: “/Game/SomePackageLocation/NewAssetName”).
Example, may I create new texture in Content Browser from a file in Windows Explorer (like “D:\test.psd” or “D:\test.png”…) by C++?
Thanks you so much, again.
I have just been made some C++ code to put a mesh with material into specify position in map, but this mesh and material must be imported in Content Browser of Unreal (import by: click import in UE → choose file → like path: “/Engine/EditorMeshes/ColorCalibrator/SM_ColorCalibrator.SM_ColorCalibrator” and “/Engine/EditorMeshes/ColorCalibrator/M_GreyBall.M_GreyBall’”).
I want to get this mesh from direct path in disk (like: “D:\test.fbx”, “D:\test.png”, “D: test.psd”… instead by path in Content Browser.
Okay, NONE of the solutions I found only where helpful for automatically saving the Asset, so here is my 50th cents… The relative path that needs to be used for Package saving is quite confusing, but I found a good way of saving assets through their packages with the following snippet:
Creating the Asset should be well covered by the previous answers. Just make sure to mark the Package with FullyLoad() if the asset is ready to be saved, otherwise Unreal will throw an error because the file isn’t loaded, thus cannot be saved, etc.