Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Question Can I get the number of frames in a animation clip from a script?

Discussion in 'Animation' started by Deleted User, Apr 14, 2022.

  1. Deleted User

    Deleted User

    Guest

    How can I get the total number of frames in a animation clip from a script?
     
  2. Deleted User

    Deleted User

    Guest

    I found AnimationClip's length parameter, but it's in seconds.
    I also found the framerate parameter.
    I think the length of the clip in frames can be determined with this,
    but I can't figure it out.
     
  3. Deleted User

    Deleted User

    Guest

    I think I'm supposed to multiply the two if I want the length in frames. I'm just gonna do that, hope it's right, and move on I guess. :(

    Edit: Unsurprisingly, it didn't work.
     
    Last edited by a moderator: Apr 15, 2022