I have an enemy (the same one as in previous questions of mine) where I have its scale set to 1.5. The parts of this enemy (children) all have a scale of 1. When I run the game, the enemy disappears...because its scale changes to 10 (which I did not script). To fix this, I thought I would change the scale every frame back to 1.5 by setting all of the transform.localScale values to 1.5. The enemy still scaled up to 10, but did reset to 1.5. The body of the enemy turned out fine, but all of the other parts of the model ended up scaling down to .1. I tried the same tactics on the parts of the enemy to scale them back to 1, but the parts that scaled down are then in the wrong position (shorter arms because they are buried within the body, eyes that moved to behind the body, etc.). I'm desperately trying to get this enemy (which worked at one time) to function. Is there anyone who has any idea of why the enemy is scaling up to 10 or how to fix it? There are no animations (yet) for this enemy.
The question has been closed Jun 16 '12 at 07:20 AM by You! for the following reason:
The question is answered, right answer was accepted
I know you said there are no animations yet, but I'd double-check that you don't have any Animation components at all, since even a "non-animated" default animation might be able to change the scale.
If that's not it, it's probably just some script changing the localScale without your knowledge. You should be able to figure out what it is using process of elimination (start removing scripts from all the components in the scene until it starts working again, and if it still happens with no scripts then check your editor scripts). Alternatively, maybe the undocumented OnTransformChanged callback still works and you could use it to get a call stack of when the scale changes.
answered Jun 15 '12 at 11:31 PM