How to destroy child of GameObject?

Sorry if this is in the wrong place, or if this is structured incorrectly.

I’ve been having trouble debugging my code and I’ve narrowed it to one particular error. In short, when I try to destroy a child GameObject it doesn’t appear to work. Here’s my code:

if (EquipmentSlot.transform.GetChild(0) != null)
{
        Debug.Log("Equipped item at remove: " + EquipmentSlot.transform.GetChild(0).gameObject);
        Destroy(EquipmentSlot.transform.GetChild(0).gameObject);
        Debug.Log("Equipped item after remove: " + EquipmentSlot.transform.GetChild(0).gameObject);
}

EquipmentSlot is the parent GameObject. When the code runs, both Debug.Logs output the same thing: the name of the child. I would expect the second log to output null, or similar. Clearly i’m doing something wrong, unless it’s a unity bug. Any help would be indescribably appreciated.

If it gets destoyed then you have nothing to worry about, it s because OnDestroy() on the Object, result of Destroy(), is called after the Update() so it won’t happen instantly thus the object is still there when 2nd debug is executed. If you want direct result use DestroyImmediate() instead. Cheers.