- Home /
Question by
decamonos1 · Apr 29, 2012 at 09:49 PM ·
gameobjectfpsparentchildweapon
Is there a way to make a selected object a child of another object during the game?
I'm making an FPS and with my weapon system I thought a simple way of attaching the weapon would be to make it a child of the character when the "E" key is pressed. I cannot find a way to make the object become a child during the game. Is there a way to do this?
Comment
Answer by asafsitner · Apr 29, 2012 at 09:54 PM
It is possible through the parent
property of the Transform component.
childObject.transform.parent = parentObject.transform
will work.