Search Unity

Overriding Transition Settings on an Animator Controller Instance.

Discussion in 'Animation' started by geist-2501, Jun 2, 2020.

  1. geist-2501

    geist-2501

    Joined:
    Dec 14, 2018
    Posts:
    5
    Hey all.

    I'm currently stuck on a problem I've encountered on a game I'm making. I want to be able to switch movesets for different weapons. I thought an Animation Override Controller would suffice, but since different attacks would have different exit times and transition durations, it won't suit. (My combat system uses the exit time for attacks so the designer has a direct way of tuning combat timing via the animator).

    So I decided I'd write my own Animator Override Controller (with blackjack and hookers ) that allows you to override the timings of transitions of states. However my new issue is that editing a transition of one Controller during runtime edits them all (All humanoids use the same Animator Controller).

    Is there any way to modify an instance of a single Animator Controller during runtime, without effecting all of them?

    Thanks!
     
  2. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
    Nope. And I suspect what you're doing wouldn't even work at all in a runtime build because the only way I know of to do what you're describing uses editor-only functionality.

    That's just one of the many reasons I made Animancer (link in my signature) which lets you avoid Animator Controllers entirely and control everything dynamically at runtime.
     
  3. geist-2501

    geist-2501

    Joined:
    Dec 14, 2018
    Posts:
    5
    Hmm, that's what I thought. If my plan B fails I'll definitely have a look at Animancer - thanks!
     
  4. Marsunpaisti

    Marsunpaisti

    Joined:
    May 3, 2018
    Posts:
    22
    Did you ever find a solution? Im working on the exact same problem.
     
  5. geist-2501

    geist-2501

    Joined:
    Dec 14, 2018
    Posts:
    5
    I think I ended up re-implementing part of the animator controller myself, and ditched transitions completely. For weapons I made a structure called `AttackBranches`, that contained the timing data and state name for each attack (and combos n stuff), and used a timer that started when an attack was triggered and `anim.CrossFadeInFixedTime` to manually switch attack states once the attack time had passed.