Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

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

    Unity Technologies

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