Making parent and children False in Hierarchy and opposite (true)

Hi there. Hope you can help. I’ve been wrestling with trying to make my platforms in the Hierarchy enabled and disabled. I have three parent objects with children objects within. On a trigger event, I want to be able to disable one object and enable the other. I’ve tried many things. What I have tried is this, but doesn’t work. At start Level1 is active (ticked) and Level2 is not active (Un-ticked):

var Level1_Page1 : GameObject;
var Level1_Page2 : GameObject;

if(other.gameObject.tag =="Level1_Page2_Barrier"){
    
    Level1_Page1.SetActive (false);
    Level1_Page2.SetActive (true);
    
    		}

Any help and understanding would be greatly appreciated!

Rich

The functionality works provided the Object isn’t a prefab.