Disabling child objects with their own child objects

Hello,

I have searched everywhere and cannot find a way to disable a child object without it being deleted forever. What I’m looking for is the javascript to simply disable the child from the parent script without completely deleting the child object.

Thanks in advance

The following script will deactivate each child of a transform. This code has not been tested, but it should work non-the-less

Reference: Unity - Scripting API: Transform

C# Version:

foreach(Transform child in transform){
     //Add a condition statement here to only deactivate the correct children
    child.gameObject.SetActive(false);
}

JScript Version:

for(var child : Transform in  transform){
     //Add a condition statement here to only deactivate the correct children
    child.gameObject.SetActive(false);
}