Hello all!
I exploit Cocos Creator model 3.8.7.
Created a saturation shader. It has a saturation parameter. Within the node’s replace technique, I easily change this parameter for the fabric.
You possibly can place a number of sprites on the stage and assign them this frequent materials. All of them easily change colour.
Nonetheless, this doesn’t work if the fabric is assigned to sp.Skeleton. No replace happens.
What to do?
I’ve already seen the same matter for model 3.7.3, the place they suggested utilizing the sp.Skeleton.updateMaterial() technique. However in model 3.8.7 it’s not there. There may be solely sp.Skeleton.updateRenderer(), which is marked as deprecated and doesn’t assist.
I discover it(updateMaterial technique) 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 high within the remark it says @engineInternal.
Apparently all of that is then parsed and once I work, I’m proven solely 5 strategies:
You get proper, some feedback of engine can certainly be complicated, and we’ve a plan to handle this problem
Is the plan being delayed? Model 3.8.8 has been launched, however this problem isn’t fastened.
I wrote an impact. It modifications colour. I created a fabric from this impact. I positioned two sprites on the scene and assigned this materials to them. I hooked up a script to one of many sprites that modifications a parameter over time and the colour ought to change. As I anticipated, if I exploit the sharedMaterial property, the colour modifications for each sprites. But when I exploit the fabric property, the colour modifications for just one sprite. That is anticipated and proper habits.
Now, as an alternative of sprites, I’m utilizing sp.Skeleton. If I exploit the sharedMaterial property, the colour modifications 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 alter the looks of only one sp.Skeleton whereas having different related objects on the scene?
To make issues clearer, let me offer you a state of affairs. Let’s say there’s a sport board. It might include sure objects (utilizing sp.Skeleton). Relying on the item’s state, totally different animations might be carried out. Moreover, some states of the item must be represented by a spotlight. The spotlight should be carried out utilizing an impact (shader). Since no different results are required, I instantly assign a spotlight materials to all such sp.Skeleton objects. Then I have to allow highlighting from code…that’s the place the problem lies.


