Making a new instantiated prefab as a child for existing GameObject

Posted by Akari on Game Development See other posts from Game Development or by Akari
Published on 2013-10-19T17:28:02Z Indexed on 2013/10/19 22:17 UTC
Read the original article Hit count: 248

Filed under:
|

enter image description here

I've been searched about how to make these fruit to move as the basket movement if it collided with it, and I've been found that if I want to perform this I've to let these fruit to be a child to the basket game object .. for example :

banana.transform.parent = basket.transform;

banana and basket each of them of type "GameObject" ...

BUT unfortunately this way didn't work !! and I don't know why ??

So now I need to know if it is possible to destroy the banana if a collision with the basket happened and instantiate a new banana in the basket as a child at run time ?!!

I need to try this stupid way because I've tried all the other ways and nothing worked :(

© Game Development or respective owner

Related posts about unity

Related posts about unityscript