- Home /
Using same named childs for Prefab
Hey,
I have a problem with my enemy prefab. I have attached 3 child to the prefab. When I instantiat like 4x my prefab they all have the same childs ; logically. But I think this cause the trouble that my physics2D.OverlapCircle isn't working anymore.
The code is attached to the prefab. So maybe this .find is the bug, because it doesnt know which "collCheckRight" o.O'
Problems by understanding my written trash ?
My Pics:
Problems in understanding ? Ask me ;P
Regards,
LifeArtist
Answer by wijesijp · Apr 25, 2014 at 11:41 AM
I think you should make the Transform variables inside your prefab public and set them to the correct child objects at design time. It should be more efficient than trying to find them at run time.
Answer by Yword · Apr 25, 2014 at 10:10 AM
Maybe you should replace GameObject.Find with transform.Find to find a child by name.
Your answer
![](https://koobas.hobune.stream/wayback/20220613143518im_/https://answers.unity.com/themes/thub/images/avi.jpg)