UI Shadow script - performance question

Hello,

I’ve been using the UI “Shadow” script a lot. In fact, most of my UI elements have multiple Shadow components attached.

How expensive is this (performance-wise)?

Would I save a lot by applying the shadows/shading directly to my image resource? Would it be worth the insane amount of trouble it entails?

Thanks

I can’t give specific numbers, but I only recently found out about the Shadow component. Before that, I was using duplicates of my UI images set on a layer below and darkened/made semi-transparent. Using shadows instead definitely boosted performance in the Profile by a few milliseconds.

As a thought, hard-rendering the shadows in the image would possibly increase performance, however there may be the drawback of rendering completely transparent pixels around the sprites (if your shadow is off-center, as they usually are), but it may be slightly better than the Shadow component.
Try taking a look at your average CPU usage in the profiler, then disable all Shadow components and check again. It’d be simple enough to write a script that disables them all, if it’s an inconvenience to do it manually.