x


Set an Instantiated Object as the Component of Another Object

Hi. I need to instantiate a new game object, but I need it to be the component/child of an already existing game object. I tried searchin' in the scripting references, but to no avail. Thanks in advance!

more ▼

asked Aug 02 '12 at 01:35 AM

brain56 gravatar image

brain56
29 7 12 16

note that "components" and "child" are quite different ideas. I'm pretty sure what you want here is the child/parent relationship. (Which travels with the Transform, it's worth remembering.)

Aug 02 '12 at 05:46 AM Fattie
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first
childObject.transform.parent = parentObject.transform;
more ▼

answered Aug 02 '12 at 02:02 AM

hvilela gravatar image

hvilela
2.1k 8 14 29

Marry me.

Aug 02 '12 at 02:31 AM brain56
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1668
x1089
x302
x183

asked: Aug 02 '12 at 01:35 AM

Seen: 280 times

Last Updated: Aug 02 '12 at 05:46 AM