- Home /
pooled prefab missing child
I just implemented pooling into my basic 2D game and one of the pooled prefabs is composed of two child gameobjects with images. It seems to work fine for a while but, after a bit, the pooled object sometimes doesn't show up and, when it does, it only shows one of the child elements. I'm confused. Does anyone know why this might be?
Check if in any moment of the game ( since you didint give us any details on what game you are working on ) you are destroying one of the childs. In pooling you have to SetActive(false) objects ins$$anonymous$$d of destroying. If you destroy one of the childs its gonna be reused later on with destroyed child so that might cause some troubles.
Thank you; the scene is surrounded by a boundary that sets the object setactive to false upon collision. There's no disabling and this only started after I implemented pooling, which I'm new to.
Answer by theunsigned · Mar 05, 2019 at 03:12 PM
I think I figured it out. I couldn't edit the polygon collider and put colliders on each child object; so, it was deactivating the first child object that collided. I found out that I could edit the polygon collider on the parent if I closed one inspector tab and restarted Unity. I did that, edited the parent collider, and disabled the child colliders. Now, it seems to be working.
Your answer
Follow this Question
Related Questions
Pooling Issue 0 Answers
Using same named childs for Prefab 2 Answers
Pooling GameObjects with TextMesh ? 0 Answers
Check if GameObjects are from the same prefab? 1 Answer
spawn from pool only if pool has inactive gameobjects 3 Answers