Hi!
I have a problem with (sigh) acessing children.
Lets say my scene has two objects:
Parent
----child
Parent has the following script for slowly moving the child object up:
function Start () {
yield PrzesunWieze();
}
function PrzesunWieze(){
while (transform.position.y < 30)
{
for (var child : Transform in transform) {
child.transform.Translate(Vector3.up * Time.deltaTime);
}
yield;
}
Basic.
Now, the problem here is that the statement in “while” loop gives me position of parent, but i need to acess the child. Is the “find” way the only way? I dont want to use it, because looking through my whole scene just for this child is like a blind man looking for his fingers.
I tried to use GetComponentInChildren, but it also gives me the parent transform. And it wouldn’t work in the long way, because i want to move only one child.
And is the coroutine like update, doing its stuff every frame, or only once?
can i maybe acess my child transform by path? That would be convienient.
Sory for my noobnes, but I cant really find a good answer to this, and unity help is not helping:)