TL;DR: Title. It shouldn’t be there in the first place.
@UT Create a separate update runner for the editor instead of relying on [ExecuteInEditMode] and update decals based on “static” state. Allow users manually update DecalProjector’s data.
Decal Projector does not consider “static” decal objects, and attempts to update each and every decal in the scene, even if its never moved.
I’ve got a situation where there’s a lot of static decals added to the scene and only some of them are actually dynamic.
For 24k decals I was getting ~10ms LateUpdate cost on Ryzen 3950x and 5ms Update cost (editor only).
I’ve solved this by removing LateUpdate and Update, and replacing them with single system / runner.
Only decals that are “dynamic” are inserted to the system. Ended up at 0.3ms for 700 dynamic decals on the same setup.
Which is ~x50 times faster.
This required modifying DecalProjector of course, but fortunately HDRP is a package.
This is good news. Unfortunately I’m stuck on 2020 LTS until Entities package gets an update, so yeah.
Edit: Although I don’t see any static decals support. With that PR / change seems like all decals data are added to the job. Unless I’m missing something. Wonder how it would handle 20k+ decals in case of bursted job.
Classic “because Unity doesn’t make games” type of issue. If timings are that bad on a high end deskop CPU, it would be absolute murder on last gen console’s CPUs.
Mishaps like this are everywhere in many of their packages, makes one wonder how many more are in the private C++ source code.
I’ve previously encountered problems with having (tens of) thousands of static decals. I ended up implementing a pretty crude hack that involves renaming the update functions and calling them manually in editor to restore interactive editing.
In my project non-static decals are such an edge case that I didn’t even bother implementing them yet, 'cause I have none, and probably won’t have any.
The new bursted decals are exciting news, but now I’m spooked that this might actually be a regression in my case.