Apart from this is a complete mess, I don´t understand the line number 6 because if we deactivate the root parent, B had to be deactivated also but it says: B.activeSelf==true ??? ( It is an error in the docs?)
I don´t understand why Unity have changed the old system because now it is much more complex and a real hassle to activate or deactivate objects in a hierarchy and is completelly unintuitive. What are the benefits? Was it necessary?
No, because C called SetActive(false) but B did not. It’s not a mess; calling SetActive activates/deactivates children in the hierarchy but does not change their activeSelf, that’s all. It is indeed more complex in that there are now two active states instead of one (active in hierarchy and active self), but the old system was in fact broken and needed to be fixed, since hierarchical activation is necessary for things like the upcoming GUI system and nested prefabs. It probably should have had this behavior all along, but better late than never, although it means breaking stuff. (But that’s what x.0 releases are for…)
I’m assuming there are some performance improvements going on behind the scenes where, when calling SetActiveRecursively, memory was being allocated for an iterator that would later need to be cleaned up by the Garbage Collector. The new method is likely faster and uses less memory. So the adage “If it ain’t broke don’t fix it” doesn’t really apply here. Sure it requires some adaptation and code refactoring, but growth and improvement isn’t always painless.