Question by
TheArgo · May 31, 2021 at 01:24 AM ·
childforeachlayerlayer mask
Change layer for unparented child.
When I pick up an object, my code changes the layer of the child object to layer 13. My question is how would I approach changing the layer of the object once it is no longer a child (a dropped object).
foreach (Transform child in slot)
{
child.gameObject.layer = 13;
}
Comment
The same way: droppedObject.gameObject.layer=0;. The real question is what variables or other tricks does your program use to remember things it has picked-up.
Your answer
![](https://koobas.hobune.stream/wayback/20220613034401im_/https://answers.unity.com/themes/thub/images/avi.jpg)