- Edited
multiple characters on scene issue
Hello, could someone help with this issue? maybe someone already had same problem. Added multiple copies of characters to scene, and after 7 characters something weird happened with some parts of character (in this case character had 2 separate sprite atlases) - but when I zoom-in scene view and change camera size(orthographic camera) - everything ok. I tried to re-export character and repack atlas (with all sprites in one) and problem gone. What it could be and is it possible to use multiple atlases with big amount of characters on scene?
Thanks in advance!
This problem looks like too agressive batching happening, which will group parts with the same texture to one draw call, messing with the resulting attachment draw order. If you then have everything on a single atlas page texture, there is no need to re-group anything by the batcher, and it will keep the order as-is.
Are you using Unity's Universal Render Pipeline (URP) in your project?
If you ever need to use multiple atlas textures, there are some solutions to this:
- You can add a SortingGroup component to each character GameObject.
- You can enable
Advanced - Fix Draw Order
at yourSkeletonAnimation
component.
Unfortunately, we got some cases reported where the batcher would still too agressively re-order things. Please let us know if the above solutions fail to resolve your problem at any time in the future.
Harald wroteAre you using Unity's Universal Render Pipeline (URP) in your project?
Some additional info (maybe it would be useful too) - Build settings IOS, all textures exported with bleed option and seted as Sprites 2D with overrided PVRTC compression. Material was seted as Sprites/Default
Im using unity 2019 2.21.f1 with basic 2D template and there I have 7 batches ( and problem ). But I checked in newer version with URP - and there no any issues with draw order ( 40 batches).
Harald wroteIf you ever need to use multiple atlas textures, there are some solutions to this:
You can add a SortingGroup component to each character GameObject.
You can enable Advanced - Fix Draw Order at your SkeletonAnimation component.
Unfortunately, we got some cases reported where the batcher would still too agressively re-order things. Please let us know if the above solutions fail to resolve your problem at any time in the future.
Tried both - Sorting group worked and raises batches count from 7 to 40(I guess that it is normal, according to your explaining of problem), Fix Draw Order - no
But i think it would be enough (guess I should think about moving to newer unity and URP) Thank you for help)
Glad to hear you've found a solution. Thanks for letting us know.