Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

How do I duplicate an fbx animation clip via script?

Discussion in 'Scripting' started by ayjrian, May 22, 2010.

  1. ayjrian

    ayjrian

    Joined:
    May 4, 2010
    Posts:
    7
    Hi all, I hope you can help me with this problem....

    I'm writing an animation system and need to be able to duplicate an animation clip that is within an fbx file. This can be done via the project view by selecting the clip within the fbx asset and duplicating normally, but for the life of me I can't work out how to do it in script. I can duplicate the whole fbx file, but not the clip within it.

    Can anyone help? Much appreciated if so!

    Thanks

    Adrian
     
  2. seon

    seon

    Joined:
    Jan 10, 2007
    Posts:
    1,441
    Welcome dude... glad you finally jumped in :)
     
  3. andeeeee

    andeeeee

    Joined:
    Jul 19, 2005
    Posts:
    8,768
    Hi, welcome to the forum!

    Are you doing this with an editor script? Is there any chance you could give a bit more detail about what you are doing?
     
  4. ayjrian

    ayjrian

    Joined:
    May 4, 2010
    Posts:
    7
    Hi andeeee, thanks for the welcome...

    Yes, I'm using an editor script. I'm writing a node based animation blending system with it's own ui inside Unity3d. I'd like to be able to import animation clips from fbx files but then duplicate it in order to get access to the AnimationEvents as well as be able to create new animation f-curves inside the animation clips. I can do all this already, but it means manually duplicating the clip rather than it all being within the ui I've created. I've had a pretty close look at the AssetDatabase class but have only managed to duplicate a whole fbx file, not an animation clip within it.

    Thanks for any thoughts.

    Adrian
     
  5. andeeeee

    andeeeee

    Joined:
    Jul 19, 2005
    Posts:
    8,768
  6. ayjrian

    ayjrian

    Joined:
    May 4, 2010
    Posts:
    7
    Re: AnimationUtility class... I've had a look and as far as I can see, there is no way to duplicate a clip, I suppose I could find a clip, get all the curves and copy them all... I was hoping for an easier way.

    cheers,

    Adrian
     
  7. netoelgrande

    netoelgrande

    Joined:
    May 16, 2013
    Posts:
    1