The Asset Manager is a new feature being added in 4.16 to allow games to add rules to easily query, cook, and load game-specific assets like quests/heroes/etc. The 4.16 version of the feature is in early access, and it will be ready for full use in 4.17. The documentation isn’t ready yet, but because the feature will be very difficult to use without any I created this thread to post my in-progress documentation. A PDF version of the doc is attached, and like everything else about this feature it is subject to change in 4.17.
So what is the Asset Manager actually? It’s a C++ class that is created once at startup, and can be subclassed by specific games. It will read settings out of the AssetManagerSettings section of DefaultGame.ini and build a dictionary of “Primary Asset Types” which are top level game-specific things that can be queried, cooked, and loaded. Once you have those types registered it provides an interface on top of the Asset Registry that allows reading information about them even if they’re not loaded. This information allows a lot of different things, detailed in the doc.
So who is this feature useful for in 4.16? If you’re a C++ programmer building a complicated game with RPG elements, and plan to update to 4.17 you should take a look as it will probably make things easier for you. If you were using the ObjectLibrary functions to load assets at runtime you definitely want to read this as this is basically a much improved version of those functions. If you’re interested please read the attached documentation, and if you have any follow up questions or feedback please leave a comment on this question.
I’m answering my own question so this counts as resolved
Is it possible to create assets at runtime dynamically in a persistent way? I mean, create assets at runtime without having to recreate them on the next startup… Loading an asset, modifying it and writing the changes back to the asset on the disk would also be very interesting. Is this possible?
That is not supported by default. Your game-specific AssetManager subclass is a good place to write that code
Then do I understand it right that I would need to write methods to serialize assets to disk using stuff like FArchive? But how does the asset manager discover those new assets at startup? Do I need to implement this as well?
And in case I modify an existing asset and want to save the changes, do I create a new file as well? And how do I prevent the asset manager from loading the old asset?
I was just saying that the Asset Manager is a good place to write custom game-specific code to deal with assets. The Asset Manager provides methods for searching and loading assets, it doesn’t have any built in logic for creating or saving them so you would need to write that. The engine doesn’t have any built in support for “runtime created assets”, so I don’t have much advice for you. If I was doing that I would probably write them to a special directory on disk so they can’t be mixed up with normal editor-created assets.
Thank you, I think I understand what needs to be done
If I get this right, I can use this class to create collections of class based assets without prior making any global references to them. Eg use it shop window with list of products that are populated on demand.
And on top of that bundle them all together so I can offer DLC? If so this is truly awesome class and deserves full blown wiki entry as well! Well done!
Yes, that was one of the primary use cases I designed the system for. If all of your shop products are in one folder you can set it up purely in ini, if it’s more complicated you can do things in your game-specific subclass
The AssertManager can’t find any objs in Paks , in the same path I can load the obj in pak. Why？ The pak is mount already