Why child object not rotate with parent?

Hey Guys,

I’m not sure what’s the problem but I’m trying to rotate gameobject and child when I click but it’s strange because child is not rotate every time I clicked.

Please watch my video clip.

This is parent gameobject’s code :

void OnMouseDown(){
    transform.Rotate((0),(0),(90f));
}

and this is a child’s code :

void Update () {
        transform.Rotate(0,5,0,Space.Self);
    }

Please let me know what I should do.

Thanks

this is only ran on mouse click

this is ran all the time, and should always be rotating.

this is why the child doesn’t follow the parent

is the child a subobject of the parent? that would be an easy way to rotate the child when the parent is clicked

Yes, child is subobject of the parent. I still don’t understand.

This is in parent and it will rotate 90 degree when I click. Its work fine when I click.

void OnMouseDown(){
   transform.Rotate((0),(0),(90f));
}

This is in child and it is alway spin itself. Its work fine too.

void Update () {
   transform.Rotate(0,5,0,Space.Self);
}

But I don’t understand. I’m not sure if I was wrong. Please give me a suggestion.

this method works as expected for me on 2017.1.0f3.

on click, parent and child rotate in increments on each click, child spins on it’s local axis properly.

do you have any other restraints or animations playing on the child?

Made sure they aren’t linked the wrong way in the hierarchy?

it’s possible that the Rotate in the update is overriding the parent.
can you please remove that rotate in the Update and test it.

did you set the child’s rotation to follow parents rotation? so everytime u click the parent the child will follow.