How to set color for a node

How to set color for a node
0.0 0


Hi guys, is there a way to setup a background color for a CCNode object? I’m using it as a container and would like to debug positioning issues. Thus, it would be really helpful to be able to actually see the node by using colors. DebugDraw only works for Sprites, which is not useful this case.


I was looking into something similar just yesterday and the answer is no. A basic CCNode doesn’t contain any real rendering information. Basically, what you want to do is create a CCLayerColor node (with a low z-index to effectively be the background) and add it as a child to your CCNode and this should do essentially what you want it to. Hope this helps!