Wednesday, December 24, 2025
spot_img

[3.8.7] [Spine] Materials can’t be up to date dynamically – Cocos Creator


Hello all!

I exploit Cocos Creator model 3.8.7.

Created a saturation shader. It has a saturation parameter. Within the node’s replace methodology, I easily change this parameter for the fabric.

You may place a number of sprites on the stage and assign them this frequent materials. All of them easily change coloration.

Nevertheless, this doesn’t work if the fabric is assigned to sp.Skeleton. No replace happens.

What to do?

I’ve already seen an analogous matter for model 3.7.3, the place they suggested utilizing the sp.Skeleton.updateMaterial() methodology. However in model 3.8.7 it’s not there. There’s solely sp.Skeleton.updateRenderer(), which is marked as deprecated and doesn’t assist.


I discover it(updateMaterial methodology) nonetheless exists in model 3.8.7. Please have a test on the hyperlink: cocos-engine/cocos/backbone/skeleton.ts at v3.8.7 · cocos/cocos-engine · GitHub

So, the tactic in that file is certainly declared as public, however on the prime within the remark it says @engineInternal.

Apparently all of that is then parsed and after I work, I’m proven solely 5 strategies:

You get proper, some feedback of engine can certainly be complicated, and we’ve got a plan to handle this difficulty

Is the plan being delayed? Model 3.8.8 has been launched, however this difficulty isn’t fastened.

I wrote an impact. It adjustments coloration. I created a fabric from this impact. I positioned two sprites on the scene and assigned this materials to them. I connected a script to one of many sprites that adjustments a parameter over time and the colour ought to change. As I anticipated, if I exploit the sharedMaterial property, the colour adjustments for each sprites. But when I exploit the fabric property, the colour adjustments for just one sprite. That is anticipated and proper conduct.

Now, as an alternative of sprites, I’m utilizing sp.Skeleton. If I exploit the sharedMaterial property, the colour adjustments for everybody. But when I exploit the fabric property, the colour doesn’t change for anybody. Is that this a bug? If not, how can I modify the looks of only one sp.Skeleton whereas having different related objects on the scene?

To make issues clearer, let me provide you with a situation. Let’s say there’s a recreation board. It might include sure objects (utilizing sp.Skeleton). Relying on the thing’s state, totally different animations will likely be carried out. Moreover, some states of the thing have to be represented by a spotlight. The spotlight must be applied utilizing an impact (shader). Since no different results are required, I instantly assign a spotlight materials to all such sp.Skeleton objects. Then I must allow highlighting from code…that’s the place the issue lies.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisement -spot_img

Latest Articles