Simple situation, seems that not-so-simple solution:
I have several cubes in a scene. All of them should be “pushable” this is, the user can click on them and a “move backwards and then goes back to the initial position” animation should play.
I have an animation clip, made using an empty parent gameObject which moves them in the way I want, but it seems I can’t find a way (if it exist) to make the animation play in the different cubes separately. (I’ve also tried making the animation for one cube, then using on the others, and nothing).
There’s an empty GameObject, parent to all the cubes, which has the animation clip, and a script which is in charge of saying animationVariable.Play(“PushBack”). The script is linked too to each button and I’m using an int to know “which button called” in a OnMouseDown function. But when it plays, all the cubes move altogether.
I’ve also tried to create an animation using one of the cubes, but of course, if I try to play it with other cube, first the cube move to the original cube position, then the animation plays.
Any idea on how to fix it? I am missing something?