Stating from Mad Level Manager 2.0.0 you can create and use texture atlases. It’s a great way to reduce number of draw calls even to one draw call on the scene! Reducing number of draw calls is one method of Mad Level Manager optimization
Creating an atlas
To create an atlas just select all the textures that you want to add to your new atlas.
And then execute from the main menu Tools → Mad Level Manager → Create Atlas.
You will be prompted to enter an atlas prefab name. Set the name and press the Save button.
Your new atlas texture and prefab will be created:
If you select the prefab, you will gain access to a prefab manager. Here you can add or remove any sprites from the atlas. To remove a sprite, press the X button. To add a sprite, drag & drop its texture into the field below.
Using atlases
You can use an atlas with all sprites and sprite properties.
You have to change this option from Textures to Texture Atlas. When it is done, you will see a field for choosing your atlas.
You have to drag & drop your atlas prefab into this field so it will look like this:
All textures from the atlas must be selected using the Atlas Browser. You just have to press the Browse button and the browser will appear:
Atlas Browser allows you to preview and choose sprites from your atlas. By clicking on the sprite once you will apply it into the field. By clicking twice you will apply the sprite and close the Atlas Browser.
Atlases and fonts
It’s really easy to add your fonts to atlases. You can either:
- Move your font texture into the atlas
- Try to use MadText component with atlas for the first time
Here’s how MadText inspector looks like.
In the Font field you have to assing your created font prefab. If you won’t assing the atlas, your font will be working but rendering a font will create a additional draw call. Use the Atlas field to assign your atlas prefab. If it does not contain your font texture, you will see a warning like above. Then just click the Add to atlas button, your atlas will be included in the given atlas, and all the rendering will be done using the atlas material.