Poor performance of DeformationManager.LateUpdate() with many skinned sprites

I am running into an issue with my game. I have made heavy usage of skinned sprites (via PSD Importer) and I am currently testing spawning 50-100 on screen at one time. I’m finding that perhaps this isn’t a good thing to do.

Up to 20 to 30 is fine, but once I get more than that on the screen, my frame rate tanks. When 80 or so are on screen, I end up getting about 15FPS - the CPU main thread taking about 80ms, and render thread about 43ms. Note, I’m making ~1500 batches, saving only 9! More on this later - please see the update at the bottom of this thread.

This is being caused (mostly) by a long running DeformationManager.LateUpdate() call.

I’ve googled this and what was being suggested seem related to the SkinnedSprite component. I’m guessing DeformationManager.LateUpdate() is responsible for deforming the sprites based on the bones. I have done some searching and found that I need to have both the burst compiler and collections packages installed for SpriteSkins to be batch, which I have both…

Now, reading the documentation on SpriteSkin, once both of these are installed, I should have a batching option enabled on the SpriteSkin component, but this is not the case. See below, I have no editable properties on SpriteSkin.

In fact, my SpriteSkin Component looks vastly different than what’s noted in the documentation (I’ve added a screen shot of what the documentation says mine should look like below.) Compared to mine (shown above), I have none of these options here…

What am I missing? Is this a problem with URP, the PSD Importer, my packages, or something else I did incorrectly?

**** Update ****
Please note, what I have found is that this seems related to the URP. When I “down-grade” to the standard renderer, it seems to batch these appropriately. The count for “Batches” and “Saved by batching” are literally reversed. Previously, it was 1500 batches and 9 saved by batching. Now it’s 10 batches and 1500 saved by batching. That said, I don’t want to have to rebuild this project in the standard renderer; that’s a pain in the butt considering how far along in the project I am. Can someone suggest a reason why this isn’t working properly with the URP?

9792132--1405299--upload_2024-4-24_16-3-25.png

We are having an identical problem with 6000.0.38f1, using URP. We have 3 SpriteSkin components in our scene, two of the sprites have 434 vertices, the other has 47 vertices. We are at a late stage with our game and don’t want to fiddle with upgrading/downgrading render pipelines. Performance is fine on desktop, but terrible on mobile – so far only confirmed on iPhone builds.

We think DeformationManager.LateUpdate() is the culprit. It shows up only when Deep Profiling is enabled. The render performance then becomes comparable between desktop and iPhone.

A bit of code analysis reveals that, on every frame, the DeformationManager synchronously waits for asynchronous jobs to complete that were started on that same frame. In my main thread, Unity? Really?

I did some testing, adjusting “Sprite Batching Threshold”, “Sprite Batching Max Vertex Count”, and “GPU Skinning*” in the active build profile, but it didn’t seem to make much difference. Maybe we can’t use batching because our sprites have fewer than 1,024 vertices (the lower-limit on “Sprite Batching Max Vertex Count”)?

I have the same issue. I have set up sprite atlas and all bones use Sprite Lit Default, the same sorting layer and order etc. There is no performance difference between CPU/GPU/GPU (batched) skinning, they all tank. The only difference is that when choosing CPU it has a single Draw Call per game object in SRP Batch, when with GPU I have as many draw calls as bones (14 in this case). In profiling the stack looks slightly different but the performance is similar. I am excited for some improvements in 6000.3, but it does not look like enough. When I spawn 400 game objects the CPU usage is literally 100x than GPU, and I have pretty good processor and mid graphics.

The reason why I want to use some rigged animations and skinned sprite is because I prototyped and I really like scattering the bones for death effect. I disable all animation components, activate rigidbody and apply appropriate forces, simulate the ground by assigning to each a “floor level” depending on their position so for example skeleton looks like it’s bones break and scatter in 3d-ish way. This is completely bugged with GPU skinning because the bones continue to animate even when all animation related components are disabled.

I would like to keep some of this, offsetting CPU work to GPU is very needed for 2D animations.