Tim Duval
Tim Duval

Reputation: 61

Unity 5.3.8 Animator - Glitch?

enter image description hereI created a bunch of non-AI animations for enemies that do basic back.forth or up/down motions. Everything was working perfect until I started working on the Boss of the level. The boss has his own tag "Boss" and enemies have their own tag as well. Anyway, the problem is when I click start, every enemy leaves the game board. I can see them animated above the game board still doing their routines.

Any clue as to why this happened and how to fix it? I'd really, really hate to have to scrap all the enemies and start from scratch...

I used the Animation tool inside unity.

Extra Note: I created an EMPTY and moved all of my enemies into that Empty object to clean the hierarchy panel up. The animations were fine before this.

************** Currently Resolved **************

Whew! Okay, so apparently Unity doesn't like it when you move your animated stuff into an empty AFTER being animated. I FIXED them by simply removing them from the EMPTY that I had placed them in. However, I'd still like to know why this is. So any useful resources, links, manuals, personal insight/observations or anywhere I can read up on this would be appreciated!

Upvotes: 0

Views: 54

Answers (1)

derHugo
derHugo

Reputation: 90813

Here is an explanation what happened:

The moment you dragged them all into the empty GameObject I guess this object probably wasn't placed on 0,0,0 in the Scene.

So Unity automatically changed all the local position values of your enemy items to fit the current position offset to the empty object.

Result: In the editmode they don't change their actual global position in the scene but their local position. This is supposed to happen if you just want to organize stuff.


However, now when you start the game and the animations are played, the animators change all the local positions to whatever is stored in your animations.

Result: all objects jump back to their original localPosition which had an offset to the empty GameObject.


To solve this make sure the empty GameObject is at position 0,0,0 and optimally has rotation 0,0,0 and scale 1,1,1 before you drag anything into it.

Easiest way to achieve that is by clicking reset in the empty objects Transform component before starting to drag stuff into it.

Upvotes: 1

Related Questions