Search Unity

How to save the Animation Blend Tree created by script?

Discussion in 'Scripting' started by cwbeta, Jun 29, 2017.

  1. cwbeta

    cwbeta

    Joined:
    Jan 12, 2017
    Posts:
    32
    In my project, I create the AnimatorController by script. Everything seems well, but the blend tree disappears each time I restart Unity and I need to recreate the AnimatorController again! The animation just shows "no motion". Does anyone knows how to solve the problem?
     
  2. cwbeta

    cwbeta

    Joined:
    Jan 12, 2017
    Posts:
    32
    Anyone can help ??? OTZ
     
  3. cwbeta

    cwbeta

    Joined:
    Jan 12, 2017
    Posts:
    32
    Anyone can help ?????
     
  4. cwbeta

    cwbeta

    Joined:
    Jan 12, 2017
    Posts:
    32
    Finally I solved the problem with the help of a colleague.
    Blend tree created by script will not be serialized without doing this:
    QQ截图20170704103927.png
    Just use AssetDatabase.AddObjectToAsset to add your blend tree to the animator controller and everything will goes well!
     
    MarlusVinicius and Baste like this.
  5. Aladdin520

    Aladdin520

    Joined:
    Apr 4, 2016
    Posts:
    1
    Thank you!
     
  6. Elijahdanie

    Elijahdanie

    Joined:
    Jul 13, 2018
    Posts:
    5
    Thank you!.
     
  7. Elijahdanie

    Elijahdanie

    Joined:
    Jul 13, 2018
    Posts:
    5
    Hey i did some digging and loaded all objects under .controller, the blendtrees are actually saved there but are somehow hidden, the notion saving blendtrees is a bad idea, its saved but hidden just like the solution you used up there, the question now is how do i save a nested asset and make it invisible, blendtrees docking underneath the .controller file is an eye sore, Help here..... :)
     
    ogwucheesther03 likes this.
  8. Ukins

    Ukins

    Joined:
    Oct 5, 2018
    Posts:
    2
    Thank you!