-
Notifications
You must be signed in to change notification settings - Fork 11
Generating Assets
There are quite a number of quirks with using the Asset Generator tool, and while there are too many to list, I'll try and explain the biggest ones here.
When you select the path to your JSON files, make sure that you select the directory above the /Game/
one - it should be the same directory as the Result Dir
in your CAS config. When you first open the Asset Generator widget, you should see only Game
and you have to click the dropdown to see the rest of the assets. In the context of the engine folder hierarchy, Game == Content
.
It is tempting to just go in and try doing every asset type all at once. But since crashes are extremely common, doing this is less efficient and harder to debug exact assets that may be causing a problem.
The way that the generator works, is that when it parses through an asset and finds a reference to another asset, in order to populate that reference, it must generate that asset too. If that second asset has its own references, it needs to generate those, etc, down the tree. For example, a blueprint may reference a material, which references 3 textures. So for that one blueprint, the generator needs to generate 3 more assets first. If the referenced asset already exists, it can immediately assign the reference and move on. This means that if you are generating blueprints first and it crashes, it is much harder to find out the exact asset that caused the crash, as it may very well be an asset it is referencing.
Therefore, you can see that there is an ideal "order" in which you should generate assets in (this list is not absolute and it is very likely that it will be different for every game):
- Cooked assets
- Textures/Texture2D/TextureCube (can be done in CLI)
- Materials (can be done in CLI)
- Sound Cues
- Everything else not in the rest of this list
- Static Meshes
- Skeletons
- Physics Assets (MUST BE GENERATED BEFORE SKELETAL MESHES OR THEY WON'T WORK)
- Skeletal Meshes
- Animation Sequences
- Animation Montages
- Animation Blueprints
- BlendSpaceBases
- Blueprints
- Widget Blueprints
- Simple Assets
- Make sure sound classes + sub mixes are connected
- Any duplicate uncook assets (e.g. maybe particle system if you are feeling lucky)
The reason I (personally) put simple asset last, is that data assets (that are simple assets) are very common in projects and their whole purpose is to provide references to hundreds or thousands of other assets, which makes tracing a crash hard. And the rest of simple asset types don't tend to ever cause any crashes since they are in their own "areas" e.g. sound mix/sound class that don't reference more complex asset types. So by the time you generate simple assets most of these will have been generated from being referenced from something else anyway.
Generally, you want to run with this OFF most of the time. This is because (especially for large projects) you don't want to have to regenerate every sub-asset even if you are only generating, say, blueprints. It wastes a lot of time. So I only have it on when I am trying to fix a bug in CAS or Asset Generator and need to properly regenerate a specific asset.
Since there is a commandlet you can generate some asset types much faster than in the editor, and also tends to avoid having to compile many shaders for certain types. However, I tend to avoid using the commandlet most of the time because it's near impossible to debug/find the cause of crashes/unhandled exceptions. So, I only tend to actually generate the following types using CLI (sometimes) - of course feel free to try more, but this is what I've found from the number of projects I've generated:
- Texture (any type)
- Material (NOT material instance/function/parameter collection)
- Simple Asset (ONLY if it is when everything else has been generated and I'm running through anything else that might have been missed)
Once you have finished generating everything, there are 2 asset types that will still technically be "wrong":
- Sound class
- Submix
This is because, if you open one up, the graph will not show the full hierarchy, but instead only each node on its own. For this to be a full reconstruction, we need these graphs to be correct.
So, simply regenerate those two asset types in-editor (refresh must be on) and, without closing UE, select them all -> right click -> Save. Then when you close and reopen UE their hierarchies should be retained.