Hey @smitpatel88
I am not creating another pointer, in the sense I’m not reallocating it memory. As I said, I am using the same DrawNode child.
Eg-
DrawNode *dn = DrawNode::create();
dn->drawSolidRect(...);
dn->setName("goodnode");
this->addChild(dn, 1);
Some where else in the code,
DrawNode *a = static_cast<DrawNode*>this->getChildByName("goodnode");
a->drawSolidRect(...);
Where I am giving different color this time.
And since a is a temporary pointer, it will automatically be removed when fn. scope gets over.
So, I am not adding to more memory.
My point is, like we can change the texture of a sprite which has already been added to the scene/layer. The same way why can’t we change the color of a DrawNode which has already been added to the scene/layer.