Regarding formatting: please use the three backticks
before and after your pasted code, or use the code tags:
[code]
code goes here
[/code] or the code button in the Full Editor
to format your pasted code, otherwise your code indentation is messed up and unreadable.
joeplayer написал
FPS will drop when change 3 more spine per second.
I assume you mean that when changing skins at 3 or more Spine skeletons, then your FPS will drop, is this correct?
In general, please note that GetRepackedSkin()
is a very costly operation, it packs images to a new texture and uploads it to your graphics card's VRAM. In general you should perform these repack operations in non-critical times like when loading a level where possible. Where this is not possible, to avoid too many costly repack operation you could:
- a) Avoid repacking and only assign the new Skin normally. This will most likely increase your draw calls and is a tradeoff.
- b) First assign the skin normally and then distribute multiple repacking operations across multiple frames. So only repack one skin per frame, in the next frame repack the next skin, etc.
- c) Rearrange your atlas images (check your draw order and check how often it would switch from one atlas to another) so that you have only few draw calls and don't need to repack at all.