How to solve the problem that cocos2d-x doesn’t work on the layer setting setopacity()

Time:2020-11-12

I wanted to set the whole layer as translucent, but it didn’t work. Later, I found that the solution was very poor

layer:setCascadeOpacityEnabled(true)
layer:setOpacity(255 * 0.4)

I don’t understand. Why doesn’t the official set cascade opacityenabled to true by default? Isn’t it pure cheating? It’s not mentioned in the document that you can’t find it on stackhoverflow. Finally, I found a solution from a Japanese blog:Cocos2d-x ででノノドのノドのをノドにっっっノドドの