Search Unity

How to set animation clip to legacy with editor script?

Discussion in 'Animation' started by hychum2, Jul 14, 2017.

  1. hychum2

    hychum2

    Joined:
    Nov 4, 2016
    Posts:
    4
    HI,
    I want to set the animation clip to legacy through editor script, is that possible?
     
  2. hychum2

    hychum2

    Joined:
    Nov 4, 2016
    Posts:
    4
    In a desperate attempt, I try to set it with this code with no success, Does anyone know Is this even close?

    Code (CSharp):
    1. private void OnPreprocessAnimation()
    2.     {
    3.         Debug.Log ("AssetProcess: Importing animation");
    4.  
    5.         var modelImporter = assetImporter as ModelImporter;
    6.         modelImporter.clipAnimations = modelImporter.defaultClipAnimations;
    7.  
    8.         modelImporter.clipAnimations.SetValue ("Legacy", long.Parse("true"));
    9.     }
     
  3. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,334
    AnimationClip has a .legacy bool property. Doesn't it work to just set that?
     
  4. hychum2

    hychum2

    Joined:
    Nov 4, 2016
    Posts:
    4
    Hi baste, thanks for replying! :)
    I need to change it to legacy in editor because I need to pack it into assetbundle. It doesn't work if it is set with AnimtionClip .legacy after the asset bundle is unpack.