Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by AntLewis · Feb 02, 2012 at 02:55 PM · animationclip

Return the name of the animation clip playing

Hi, is there any way to return the currently playing animation clip, aside from creating a function which iterates through all the clips and testing each using animation.IsPlaying?

Cheers

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by flamy · Feb 02, 2012 at 03:19 PM

animation.clip.name;

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image AntLewis · Feb 02, 2012 at 03:41 PM 0
Share

Hmm strange - I have an animation clip imported from max (maxClip) which I've split up into several clips. When I play the first clip, it plays what it should (that is a portion of the entire clip) but it still says that $$anonymous$$axClip is playing as opposed to section1 (the name of the clip I created from $$anonymous$$axClip). Any ideas? Thanks for the assistance. BTW the 'play automatically' box isn't ticked

avatar image flamy · Feb 02, 2012 at 03:55 PM 0
Share

sorry i never tried getting name when spliting the animation, dont have unity to try now either =/

avatar image
0

Answer by juan-jo · Apr 12, 2020 at 11:47 AM

As of today it has been difficult for me to find conclusive information on this topic, so I'll try to help here:

With legacy animations, the playing clip name cannot be obtained. Indeed you have to iterate through all the clips and ask if they are playing or not.

I'll put here a simple tool and code sample. Is enough to attach it as a component to the same GameObject that has the Animation.

 using UnityEngine;
 
 public class inspector_animacion : MonoBehaviour
 {
 #if UNITY_EDITOR
 
     Animation anim;
 
     public string normalized_times;
     [TextArea]
     public string animaciones_en_play;
     [Space]
     public float time_scale = 0.3f;
     public bool aplicar_time_scale;
 
     void Start()
     {
         anim = GetComponent<Animation>();
     }
 
     void Update()
     {
         Time.timeScale = (aplicar_time_scale ? time_scale : 1);
 
         normalized_times = animaciones_en_play = "";
 
         foreach (AnimationState state in anim)
             if(state.enabled)
             {
                 normalized_times += state.normalizedTime + "  ";
                 animaciones_en_play += state.name + "\n";
             }
     }
     
     #endif
     }

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Playing an animation 2 Answers

Animation layers: Am i limited to only one layer per animation? 0 Answers

Animated FBX: Model Rest Position 0 Answers

Is it possible to add blendshape animation through script? 2 Answers

Can the animation editor create local rotational data? 3 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges