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.4k 1616 1255 1299

(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
32.9k 19 80 290

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:

x3475
x646
x585
x251

asked: Mar 15, 2011 at 07:45 AM

Seen: 5894 times

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