Modding:AssetManager

From Vintage Story Wiki

AssetManager

The AssetManager is used to manage all assets in the game. Different systems use it to retrieve various files like translation files, textures, etc. It can also be used to retrieve files that are not handled/loaded automatically, for example static content (should be located in the config directory of assets).

The class contains different methods to make retrieving easier. For example to get the a text file that was stored in mymod/assets/mymodid/config/reallybigfile.txt you can use

var asset = api.Assets.Get(new AssetLocation("mymodid","config/reallybigfile.txt"));
var text = asset.ToText();

One thing to keep in mind is that although the file may be named with a different casing, the paths in the various methods in the AssetManager need to be lowercase. So while the file may be named "ReallyBigFile" the call to the method must be "reallybigfile".