- Home /
Question by
TheCount · Jan 07, 2014 at 03:11 AM ·
javascriptinstantiateparentmove an object
Instantiate object to move with other gameObject
I am trying to instantiate an object above another moving object, and have that object slowly move down over the moving object it was instantiated over.
What I have done is had the object change a variable on the other object from zero to one.
I have set that object so that when this variable is set to zero, to instantiate the object over itself.
The problem I run into, is that the object doesn't move with the parent
Here is my current code:
if (variable== 1){
var newObj = Instantiate(newObj1, transform.position + transform.up * 8, Quaternion.identity);
newObj.transform.parent = transform;
variable = 0; }
I don't know why this isn't working. Please help
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613125731im_/https://answers.unity.com/themes/thub/images/avi.jpg)