- Home /
Question by
TripodGRANNE · Oct 20, 2011 at 01:36 AM ·
javascripttransformparent
Detach From Parent
I know i can use something like this to attach an object.
var player = GameObject.FindWithTag("Player").transform;
//Attach Object
transform.parent = player;
How Could i detach the object i attached?
Comment
Best Answer
Answer by aldonaletto · Oct 20, 2011 at 01:41 AM
Just set transform.parent to null:
transform.parent = null;
You can read about this in http://unity3d.com/support/documentation/ScriptReference/Transform-parent.html
Oh wow i should have noticed that thanks for the help.
$$anonymous$$ark the answer as ´correct´ if was indeed the correct one.