Home Game Development animation – Unity Animator default values overwriten

animation – Unity Animator default values overwriten

0
animation – Unity Animator default values overwriten

[ad_1]

I have created a project to reproduce the problem I’m currently facing.
I’m running a simple unity animation that moves a game object and expect to be able to reset the gameobject position. This can be done by adding an empty animation, that (since it does not change anything) simply writes the default values, thus returning our gameobject to its original position.

But here is where things get complicated: if the animator gameobject is set inactive while the animation is running, new incorrect defaults values will be saved when gameobject is activated, and I am unable to reset my gameobject position.

To reproduce this issue, run the attached project:
(Download from here)

  1. Change the stop method to “PlayEmpty”
  2. Hit Start Animation and watch the left “Hello world” text travel.
  3. While it is traveling, click Disable Text GO. The left text disappears.
  4. Click Enable Text GO and see the text comes back at its last location.
  5. Click Start Animation and watch the left “Hello world” text travel.
  6. Click Stop Animation – the text is returned to the position where it was when enabling the gameobject, rather than its original position.

Any help is welcome, suggestions on how to change the code to make the above scenario work.

Thanks,
Yaniv

[ad_2]