I assume that you're using SkeletonGraphic
when you're describing "Spine for UI animations", is this correct?
KargEn The main problem we're facing is that Spine animations seem to impact performance even when they are not being rendered at the time and their GameObjects are set to inactive.
Are you sure that you mean that you've disabled the whole skeleton GameObject? If the whole GameObject is disabled, no animation is processed, the mesh isn't updated and nothing is rendered. Animations are updated in Update
while the mesh is updated to the changed animation state in LateUpdate
.
KargEn Even when no Spine animations are visibly active on the screen, they still affect performance.
For SkeletonGraphic
(and CanvasRenderers
in general), unfortunately only being outside a RectMask2D
parent component will trigger the "became invisible" state (based on the RectTransform
bounds). This is due to MaskableGraphic.onCullStateChanged
limitations by Unity (see this issue ticket here). Unfortuntately Unity does not call OnBecameInvisible
as with MeshRenderers
when e.g. the Canvas no longer contains the rect.
So if you can't use a RectMask2D
parent, you might want to write your own scripts which detect and disable the RectTransform being outside the sceen rect.
KargEn Despite some of our Spine animations having no additive materials and using a single texture, we receive warnings that we need to enable the Multiple Canvas setting. We've enabled this where necessary.
By "Additive materials", do you mean Slots with slot blend mode Additive
? If so, please note that additive blend mode can be drawn in a single draw call with PMA shaders. Multiply
and Screen
slot blend modes however require additional separate Materials.