child object does not show position change in editor even though it is rotating with its parent.

i have instantiated an object and made it a child to another gameobject which constantly rotates so that it rotates along with it too. after this, when the instantiated object reaches a certain position, another clone of the same object is supposed to spawn at the same place where the first one was spawned… and so on. basically i am trying to maintain a constant gap between spawned objects which have a common constantly rotating parent. this is the code i am using:

var brick : Transform;

private var curObj : Transform;

function Start () {
                while (true)
                	{ 
        			if (!curObj || (curObj.position.y==6.5 && curObj.position.z>0))
        				{               
                		curObj = Instantiate(brick, Vector3 (0, 0, 10), Quaternion.identity);
						curObj.transform.parent = transform;
						print(curObj.position.y);
						}
					yield;
					}
					}

the first object is spawned but the next one never spawns because the position of the spawned object never changes (maybe because it is a child of another object)…

please help me fix this.

You haven’t really answered your own question. So I think I will.
The values that you see in the inspector are according to the current coordinate system.

Thus a child, with a rotating parent, does not change position or rotation, as the current coordinate system springs from the parent. You would have to do some ‘from object to world’ coordinate transformations and print the values to see the result you were looking for.

You current solution is based on a time delay, but you could also check the eulerAngles of the parent object.

parent.transform.eulerAngles = new Vector3(some, different, values);

and spawn a child whenever a value or more reaches som arbitrary value.

I hope you could use this for something.

P.S. :stuck_out_tongue: it’s not very good conduct to mark your own answer as the solution.

nevermind… i just used yield wait for seconds…