Line 71: |
Line 71: |
| | | |
| ===Content loading API=== | | ===Content loading API=== |
− | The <samp>helper.Content</samp> API was confusing, since game content assets and mod files are handled differently. Some methods had an optional <samp>ContentSource</samp> parameter (which was easy to forget to specify), some only made sense for one or the other (like <samp>GetActualAssetKey</samp>), and the documentation tried to handle both by being more abstract. | + | The <samp>helper.Content</samp> API was confusing, since game content assets and mod files are handled differently. Some methods had an optional <samp>ContentSource</samp> parameter (which was easy to forget to specify), some only made sense for one or the other (like <samp>GetActualAssetKey</samp>), and the documentation tried to handle both by being more abstract. All assets it loaded were also non-cached, which could affect performance and prevented features like the [[#Content interception API|new content events]]. |
| | | |
− | It's been split into two APIs to fix that: | + | It's been split into two APIs to fix those issues: |
− | * <samp>helper.GameContent</samp> loads assets from the game's <samp>Content</samp> folder or [[#Content interception API|content interception]];
| + | |
− | * <samp>helper.ModContent</samp> loads assets from your mod's files.
| + | {| class="wikitable" |
| + | |- |
| + | ! field |
| + | ! notes |
| + | |- |
| + | | <samp>helper.ModContent</samp> |
| + | | Loads assets from your mod's files. These aren't cached (similar to <samp>helper.Content</samp>), so they'll be re-read from the file each time you load them. |
| + | |- |
| + | | <samp>helper.GameContent</samp> |
| + | | Loads assets from the game's <samp>Content</samp> folder or [[#Content interception API|content interception]]. Assets loaded through this ''are'' cached (which is needed for the [[#Content interception API|new content events]] to work). |
| + | |} |
| | | |
| Here's how to migrate existing methods & properties: | | Here's how to migrate existing methods & properties: |