x


Dynamically parent gameobjects

How do you dynamically parent gameobject at runtime?

more ▼

asked Mar 15, 2011 at 07:45 AM

ina gravatar image

ina
4.6k 1630 1272 1324

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

You need to use the parent property on the transform:

transform.parent = anotherTransform;
more ▼

answered Mar 15, 2011 at 07:49 AM

Mike 3 gravatar image

Mike 3
33.3k 21 93 299

How do you reference a dynamically created object though

Mar 15, 2011 at 07:59 PM ina

var instantiated = Instantiate(prefab) as GameObject; transform.parent = instantiated.transform;

Mar 15, 2011 at 08:31 PM Mike 3
(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:

x3759
x698
x619
x262

asked: Mar 15, 2011 at 07:45 AM

Seen: 6148 times

Last Updated: Mar 15, 2011 at 07:45 AM