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 1626 1266 1313

(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
33k 21 83 292

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:

x3639
x672
x605
x253

asked: Mar 15, 2011 at 07:45 AM

Seen: 6096 times

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