- Home /
GameObject Disappears when Setting Parent
I have a sprite game object. Whenever I set its parent to a programmatically sprite it will no longer render. When the game is paused, I can see the sprites transform controls in the scene but can not see the sprite itself. Oddly enough, if I assign it to a sprite that was not programmatically generated(exact same attributes though) the sprite shows up fine. All layers are being shown... now sure what is causing this.
Probably the parent object is disabled, so children are being disabled too.
Answer by Sunrunner · Nov 18, 2014 at 04:21 PM
Turns out if you set localeScale property on the parent game object all of the children will disappear. This was what I was doing:
gameObject.transform.localScale = defaultScale;
Your answer
Follow this Question
Related Questions
Parenting from code doesn't really change the hierarchy 1 Answer
Getting the topmost parent 1 Answer
Animation precision? 0 Answers
Accessing a GameObject parent Object 2 Answers