Texture Groups


Texture Group Editor

The Texture Group Manager is available from the Tools Menu in the IDE. Here you can add, delete and rename Texture Groups. GameMaker Studio 2 permits you to assign each of the graphics resources (sprites, tilesets, and fonts) to different texture groups to try and optimise the number of texture swaps that the hardware does at any given time in your game. For that to work, you need to define the necessary texture groups from this window, and then go through each of the appropriate resource types and select the group you wish it to belong to from the drop down menu. Alternatively you can add resources to a texture group via the right mouse button menu in the resource tree. You can select one or more resources (or a resource folder) and then use the RMB menu to add the resources to any group, as shown below for tilesets: Resource Tree RMB Menu For Tilesets


By default all images in your game will be added to the "Default" texture group, which always exists. However you can click the Add New button to create a new texture group, and if you select the name of the group you can change it something appropriate. To start with the group will show "this group is empty" for each section of the group (Sprites, tilesets and fonts), and so you then need to go through your resources and add them. You can add a resource using the Add resource button at the bottom, or by selecting the texture group from the resource editor for the image, tile set, or font. Texture groups other than the "Default" one can also be deleted at any time, which will move their contents into the "Default" group (note that if you delete a group by mistake you can use / + Z to undo the action).

Once you have defined texture groups and assigned sprites to them you will see them listed on the left of the main Texture Group editor window, and clicking on any of the sprites in this list will show them in the image preview window on the right. This is particularly helpful when working on large projects and you need to be able to see which sprites have been assigned to which group. Note that if the sprites assigned to the group have multiple sub-images (ie: they are animated), then only the first sub-image is shown in the preview window. You can also right click on a resource to open a small menu giving you the option to move it to another texture group or open the editor for that asset.

It is worth noting that even though the assets are shown in the list as being separate, all sprites, tilesets and fonts will be added to the same texture page (or pages), and not get an individual page for each resource type.


Group Settings

The group settings are used to determine exactly how the texture pages for a given group should be created with the following options available:

Other than those settings you can also choose to export (or not) any given texture group to any given platform by simply checking or un-chicking the appropriate boxes from the Use Group On... section of the window. Note though that the <Default> texture group is always exported to every platform, and you can't check/un-check any of them (only custom texture groups permit this).


Configurations

Texture Groups are also linked to the Configurations settings. What this means is that you can define texture groups for each individual configuration of your game, and then set the sprite, tile set or font resource assignments to these different groups and it will be "remembered" when you change to a different configuration. The same will happen to any export options that you have chosen in the Texture Group window, so you can set the texture groups to export to specific platforms on a per-configuration basis.

One use for this is, for example, that you could make an iPad configuration and for that create 2048x2048px texture pages (setting this up via the Game Options). You would then assign all the graphics assets to the appropriate texture group, and when finished, you would then change to a different configuration (for HTML5, for example) and from the Texture Group window, create new texture groups that are 512x512px, assigning the assets to these new groups. There is also a button at the bottom of the page that permits you to copy texture group settings from one configuration to another.