if i have a prefab such as a ball and i want to instantiate it and then parent it under a another object how do i do this to the instantiated game object and not its prefab?
example:
var ball : GameObject;
Instantiate(ball,transform.position,transform.rotation)
ball. transform.parent = transform
it does not work because ball is a prefab. how do i do it to the instantiated object and not the prefab it was instantiated from?
Simply assign a variable to hold the instance identity. instead of calling instantiate on its own, you can do:
var myObject : GameObject = Instantiate(ball,transform.position,transform.rotation);
myObject.transform.parent = transform;
consider you are going to make "board " as parent and "ball" as a child means....
var myObject : GameObject = Instantiate(ball,transform.position,transform.rotation);
myObject.transform.parent = GameObject.Find("board").transform;