Search Unity

Question Linking animation frame to script

Discussion in 'Animation' started by Geffx, Jul 5, 2021.

  1. Geffx

    Geffx

    Joined:
    Feb 28, 2017
    Posts:
    1
    Hello !

    Got back into a project of mine recently and i still suck at scripting, surprisingly, so i need of some help if possible ^^

    Basically, I have a 3D model representing the health pool of an actor. This 3D model has an animation to fill up or deplete health from said actor.

    What I'd like is to have a script that can act on the animation to represent the percentage of health the actor currently has. Like when the actor is at 100% health, animation is at frame 0, when at 50% it's at frame 49, when at 0% it's at frame 99. I strongly assume it's possible, but I'm struggling to get back into scripting ^^
     
  2. KalOBrien

    KalOBrien

    Administrator

    Joined:
    Apr 20, 2021
    Posts:
    89
    So it might be better if you do this via script. I recommend this video by Brackeys!