- Home /
How do I spawn a object as a child?
I'm making a prop hunt like game so I can practice coding a little more, but I can't seem to get an object to spawn as a child to my character controller. I've read about transform.parent in the documentation, but I can't get it to work. Can someone help please.
It's a pretty simple concept. What about it is not working? transform.parent = someothertransform;
Answer by Kiwasi · Aug 19, 2014 at 09:26 PM
GameObject clone = (GameObject)Instantiate(prefab, position, rotation);
clone.transform.parent = transform;
Your answer
Follow this Question
Related Questions
How to instantiate an object inside parent using parent's scale 1 Answer
Resetting Ball Object to the original parent and position 2 Answers
Why is the object not parenting? 0 Answers
[Solved] Problem with rotation on an Instantiated Object 0 Answers
transform.DetachChildren() is deactivating my children's scripts after detaching from the parent 1 Answer