I removed the else on line 20 because it was not needed.
Line 22 calls a new method with the draggable object (or its child) and the object it just collided with.
Line 30 accepts two gameobjects.
Lines 32 and 33 retrieve those objects’ states.
Line 35 checks if the colors/states are equal.
If not, then line 38 removes all children from the draggable object.
Line 40 destroys just the script instance that makes this object draggable. It does not delete the object from the screen.
Line 42 sets the gravity to so much on the draggable that it will fall off screen.
There is not an array of the children to go through and remove. We could hold those references ourselves in an array easily since we know the object collided with on line 9.














