I’m using a lot of nodes, which have children with the same names - it doesn’t break anything. I’m using it all the time.
Sure, using getChildren() and getting throught all children is slower then getChildByName, which looks like this:
Node* Node::getChildByName(const std::string& name) const
CCASSERT(!name.empty(), "Invalid name");
size_t hash = h(name);
for (const auto& child : _children)
// Different strings may have the same hash code, but can use it to compare first for speed
if(child->_hashOfName == hash && child->_name.compare(name) == 0)
holding reference is again faster than getChildByName, but you have to have tousands of nodes to maybe see any difference (yet rending them will K.O. performance).