Search Unity

Animation to prefabs

Discussion in 'Scripting' started by Sriharsha_AK, Dec 4, 2018.

  1. Sriharsha_AK

    Sriharsha_AK

    Joined:
    Dec 4, 2018
    Posts:
    3
    I created a bar chart and I used prefab for that and for that I want to create an animation that is like a dynamic bar chart like on click of play the bar will rise upto statistical values from base. I am unable to achieve this thing. How can I achieve this.
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    4,084
    Generally Unity animations are used to modify a particular parameter over time.

    This could be the scale, the position, the rotation, the sprite, etc.

    In your case it sounds like you'd need to use the animation to drive the value from 0 to whatever it should be.

    Review how to use animations in general and you'll see how to apply it to your bar chart.
     
  3. Sriharsha_AK

    Sriharsha_AK

    Joined:
    Dec 4, 2018
    Posts:
    3
    Ya what you said is true and I also explored the animation present in it but I am unable to achieve the task.
     
  4. KudoJimmy

    KudoJimmy

    Joined:
    Sep 6, 2017
    Posts:
    27
    Sorry, But If I am not wrong, you just need to change the size of bar graph in Animator Window for it to move. Now, its size in Animator will depend on its value. You will have to form a formula which converts, your values into size value for Animation, and then you can apply it.