- Home /
Best way to - Animation Sync - Multiple gameObjects.
Hello everyone.
I'll cut straight to the point.
I created 4 gameObjects, they resemble a human.
1.Body 2.Hair 3.Shirt 4.Legs
The idea is that when I press a button the Body moves. There's a problem:
Sometimes when I click this button multiple times, the animations get out of sync. You see, as you can imagine, the idea is that everything moves with the body.
Is there any way I can bypass this?
Here's what Im doing:
GUI Button:
void OnGUI () {
_rightButton = RightButtonClicked();
}
RightButtonCLicked:
private bool RightButtonClicked(){
return GUI.RepeatButton(new Rect((Screen.width - BUTTON_WIDTH - 10),Screen.height - (BUTTON_HEIGHT * 2),50,50),"", "Dpad_ArrowR");
}
Now, In update I check if _rightButton == true, if it is Do this:
public void MoveRight(){
_playerAnimManager.SetMoving(true);
//Moving Code...(transform..etc..etc)
}
Now, here's player Anim:
public void SetMoving(bool isMoving){
///_anim represents the body.....
_anim.SetBool("isMoving",isMoving);
if(_bodyController != null)
_bodyController.SetMoving(isMoving);
if(_legsController != null)
_legsController.SetMoving(isMoving);
if(_hairController != null)
_hairController.SetMoving(isMoving);
}
Is this the proper way to be doing this animation? **When user presses the button multiple most of the times the animation gets out of sync....how can I solve this!? its pretty frustrating. I've checked the animation speeds and transitions, they're all the same...
maybe due to recursive function of Set$$anonymous$$oving ?
How would you solve this? Set$$anonymous$$oving isn't being called by itself is it? equipments.Set$$anonymous$$oving just sets _equipmentsController anim Bool to true so the animation begins.... (equipments in this means legs,armor,head...)
Your answer
Follow this Question
Related Questions
Handling Movement - Animations 1 Answer
Animation Change after changing pixel 0 Answers
2 Different animations with 2 different update modes? 0 Answers
Unity GUI 4.6 stops animation 0 Answers
Animated GUI sprite not animating. 0 Answers