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 to avoid load all clip into memory when I using Animator?

Discussion in 'Animation' started by watsonsong, Mar 7, 2019.

  1. watsonsong

    watsonsong

    Joined:
    May 13, 2015
    Posts:
    555
    My character has variants of weapons, I use a sync layer for each weapon in a controller. But I find it hard to avoid load all animation clip into memory, but in fact other weapon clip is rare to use because in most time the player keep in using just one weapon.

    Maybe I can use a custom playable graph but I can not find some best practice about this. How to switch weapon when play the switch weapon animation. How to deal with the asset async-load and animation blend.
     
  2. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,554
    The Playables API is definitely the approach I'd recommend, though the raw API is very low level and not particularly easy to learn so you'd need to figure out and implement a lot of simple things yourself (like cross fading) unless you use something like my Animancer plugin (there's a link in my signature). It should be relatively straightforward to use Resources or Asset Bundles to load your AnimationClip asynchronously, then you can just use Animancer to play that clip whenever you want.
     
  3. andrew_unity628

    andrew_unity628

    Joined:
    Apr 1, 2020
    Posts:
    9
    I'm working on a system which allows mods and I have everything working with loading FBX, textures, avatar, etc. from files on disk (outside of Resources, Asset Bundles), but I need the ability to load an animation clip from disk, e.g. "die.anim" and end up with an AnimationClip object I can then assign to play via Animancer. What's the best way to go about this?
     
  4. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,554
    Unfortunately, Unity doesn't support creating non-legacy animations at runtime and Animancer can't play legacy animations. So if you can't use Asset Bundles then your only option is to use the legacy animation system.