[3.8.7] [Spine] Material cannot be updated dynamically

Hi all!

I use Cocos Creator version 3.8.7.

Created a saturation shader. It has a saturation parameter. In the node’s update method, I smoothly change this parameter for the material.

You can place multiple sprites on the stage and assign them this common material. They all smoothly change color.

However, this does not work if the material is assigned to sp.Skeleton. No update occurs.

What to do?

I have already seen a similar topic for version 3.7.3, where they advised using the sp.Skeleton.updateMaterial() method. But in version 3.8.7 it is not there. There is only sp.Skeleton.updateRenderer(), which is marked as deprecated and does not help.


I find it(updateMaterial method) still exists in version 3.8.7. Please have a check on the link: cocos-engine/cocos/spine/skeleton.ts at v3.8.7 · cocos/cocos-engine · GitHub

So, the method in that file is indeed declared as public, but at the top in the comment it says @engineInternal.

Apparently all of this is then parsed and when I work, I am shown only 5 methods:

You get right, some comments of engine can indeed be confusing, and we have a plan to address this issue

Is the plan being delayed? Version 3.8.8 has been released, but this issue isn’t fixed.

I wrote an effect. It changes color. I created a material from this effect. I placed two sprites on the scene and assigned this material to them. I attached a script to one of the sprites that changes a parameter over time and the color should change. As I expected, if I use the sharedMaterial property, the color changes for both sprites. But if I use the material property, the color changes for only one sprite. This is expected and correct behavior.

Now, instead of sprites, I’m using sp.Skeleton. If I use the sharedMaterial property, the color changes for everyone. But if I use the material property, the color doesn’t change for anyone. Is this a bug? If not, how can I change the appearance of just one sp.Skeleton while having other similar objects on the scene?

To make things clearer, let me give you a scenario. Let’s say there’s a game board. It may contain certain objects (using sp.Skeleton). Depending on the object’s state, different animations will be performed. Additionally, some states of the object need to be represented by a highlight. The highlight will have to be implemented using an effect (shader). Since no other effects are required, I immediately assign a highlight material to all such sp.Skeleton objects. Then I need to enable highlighting from code…that’s where the difficulty lies.