• Runtimes
  • How does changing the skin on multiple objects affect performance?

Good afternoon!
I have a spinning coin. The spinning effect is created by switching sprites in the cell. There are about 20 sprites in total.
I want to make different skins for the coins.

Skin 1 will have a total of 20 sprites. Skin 2 will have its own 20 sprites. And so on.

How high will be the load on the system, when changing the skin of the coin? There are about 200 coins on a level.

Related Discussions
...

Good afternoon!

Changing the skin on multiple objects, such as your spinning coins, can have varying impacts on performance depending on how it is implemented. Here are some key points to consider:

  1. Repacking Skins: If you are repacking skins frequently, this can be a costly operation as it involves creating new textures and uploading them to the GPU. It is recommended to avoid repacking during critical gameplay moments. Instead, repack during non-critical times, such as level loading.

  2. Draw Calls: If you avoid repacking and simply switch attachments, this might increase the number of draw calls, which can affect performance. However, if your textures are well-organized in atlases, dynamic batching can help reduce the number of draw calls.

  3. Number of Skins: Having a large number of skins (e.g., 200 coins each with multiple skins) should not inherently cause performance issues as long as the skins are managed efficiently. The key is to ensure that only the necessary attachments are active and that the skins are not repacked unnecessarily.

  4. Benchmarking: The best way to determine the performance impact is to benchmark your specific use case. Measure the performance on your target device with the actual scene and number of objects you plan to use.

In summary, changing skins frequently can be managed efficiently by avoiding repacking during critical times and ensuring that your textures are well-organized to minimize draw calls. Benchmarking your specific scenario will provide the most accurate insight into performance impacts.

@EIvanov Which runtime are you using?

Regarding texture loading: If you're using Unity, please note that any atlas page textures that are referenced by the AtlasAsset associated with your SkeletonDataAsset (the AtlasAsset references Materials, and the Material references the atlas page Texture) will be loaded when your skeleton is loaded.