Skip to content

Commit c2841cc

Browse files
committed
Fixed parenting.
1 parent fe623ec commit c2841cc

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/components/Children.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,18 @@ Phaser.Component.Children.prototype = {
3030
{
3131
return child;
3232
}
33-
else
33+
else if (child.parent)
3434
{
3535
child.parent.children.remove(child);
3636
}
3737

38-
child.parent = this;
38+
child.parent = this.gameObject;
39+
40+
// Should this be done here?
41+
if (this.gameObject.transform)
42+
{
43+
this.gameObject.transform.add(child.transform);
44+
}
3945

4046
this.list.push(child);
4147

0 commit comments

Comments
 (0)