x


Dynamically parent gameobjects

How do you dynamically parent gameobject at runtime?

more ▼

asked Mar 15, 2011 at 07:45 AM

avatar image

ina
4.8k 1634 1281 1331

(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

avatar image

Mike 3
33.7k 21 119 306

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:

x3974
x742
x659
x273

asked: Mar 15, 2011 at 07:45 AM

Seen: 6259 times

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