transform.SetParent(null) does not work; does not remove transform from parent

5.8k Views Asked by At

Using Unity 4.6 with 2D objects. Somehow, at the end of a DOTween sequence, in the OnComplete() block, it seems that the Text label transform (recttransformLabel.DOMove) is not removed from parent. It's still in the Unity hierarchy. Btw the DOMove below does work so what this sequence does it moves a label and when the movement is done the label should be removed from hierarchy.

DOTween.Sequence() // http://dotween.demigiant.com/documentation.php
                    .Append(recttransformLabel.DOMove(TARGET, 0.5f * AF))
                    .OnComplete(() => {
                        Debug.Log("Remove from parent: " + recttransformLabel);
                        recttransformLabel.SetParent(null);
                    });

Any way to fix this? What could be the reason?

1

There are 1 best solutions below

0
On

Have you tried just setting the parent to null from the off? recttransformlabel.parent = null