Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Apply same animator structure with different clips to different enemies

Discussion in 'Animation' started by my_password_is_my_username, Mar 17, 2022.

  1. my_password_is_my_username

    my_password_is_my_username

    Joined:
    Oct 7, 2021
    Posts:
    12
    Hi,

    I thought this one would be simple but it seems it isn't: I have a set of simple enemies in a defense game which have 4 states - idle, moveforward, attack and die. The corresponding animator is identical for each enemy with a "State" int that controls which of the corresponding animations should be played. No exit times or blending, just flip the state and switch immdeiately.

    When adding new enemies, I need to generate Animators which contain the clips for the 4 states and assign the transitions. For now this is not much work, but (a) I may have more enemies later and (b) when I change something, let's say I add a spell attack or more movement options I need to adjust all animators to keep a consistent interface. So is there a way to define an animator blueprint for the states and transitions in the editor or in code and then change the animation filenames via script or editor component to match the underlying model? I've had a look at the Animator and OverrideAnimator scripting manuals and it seems they cannot do what I need.
     
  2. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,491
    It sounds like you are misunderstanding what Animator Override Controllers do, because they do exactly what you're describing.
     
  3. my_password_is_my_username

    my_password_is_my_username

    Joined:
    Oct 7, 2021
    Posts:
    12
    Wow. It's right in the first sentence of the description. No Idea how I could miss that.