Quantcast
Channel: Latest Questions by Santa
Viewing all articles
Browse latest Browse all 88

Remove all clips from animation by script

$
0
0

Hello,

How to remove all AnimationClips from Animation via script? The same as set Size in editor to 0 but from script. I'm trying do do so:

while ( animation.GetClipCount() > 0 )
    for (var state : AnimationState in animation) 
        if ( state )
        {
            animation.RemoveClip( state.clip );
            break;
        }

but the Unity crashes if there is a clip marked in editor as "None". Can't find out why is it so.

Is it another way? Or I'm doing something wrong?


Viewing all articles
Browse latest Browse all 88

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>