- Home /
Changing object scale in script while animation is running
Is it anymore possible to change transform's scale if there's an active animator in the object?
I have a kind of a cloud consisting of circles. Every circle object has a script attached to randomly change their scale to make the cloud seem more lively. I also have animator on the cloud to change it's overall shape by moving the circles.
In Unity 4 this worked just fine. Animation took care of the placement of the circles and the script controlled their size. Now after upgrading to Unity 5 it stopped working. It seems that just having an animator makes it impossible to change objects' scales by script, even if there's no curves for the scales in the animation.
Can this kind of things be done in Unity 5 at all?
I had some issues in unity 5 with scaling animated UI elements. Check if your scale is changing in the inspector, not in the game window. I had a problem with that, my scale values were moving, but It didn't show on the game window. $$anonymous$$y solution was to "touch" the animated parent transform in every frame, while the animation was playing. By touching I mean transform.position = transform.position;
You don't have to use animator, I still use legacy animations.
Answer by jdaliz · Feb 01, 2016 at 05:13 PM
Add the object you want to animate and rescale in a empty object. In the script you can rescale the parent object, and change the position. The scale and the position will be applied to the child.
Your answer
![](https://koobas.hobune.stream/wayback/20220613200546im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Imported Scale Animation Ignored in Viewport 0 Answers
Will humanoid rigs ever support stretch? 0 Answers
Animator, animation and proportional scaling 1 Answer
Scaling Animation for a Instantiated Object 1 Answer
character & objects import in different scale & animation dosent work right anymor!!!! 1 Answer