Search Unity

Question Multiple animation controllers or only one for one object?

Discussion in '2D' started by cyberdrunkdev, Jun 4, 2023.

  1. cyberdrunkdev

    cyberdrunkdev

    Joined:
    Dec 6, 2022
    Posts:
    32
    I have a character, it has walk animations. Now i need to animate the character to open a door, so he has to move his hand to open the door which is one animation. And this same character will have many more such animations, like "Drink beer", "Open door", "put a radio on" etc.

    Should the character animations all be in the same animation controller, or should i create for every such animations a new controller and then just change the controller from the fly when executing it?
     
  2. cyberdrunkdev

    cyberdrunkdev

    Joined:
    Dec 6, 2022
    Posts:
    32
    Chat-gpt:
    In general, it is more efficient and organized to have a single animation controller for your character with multiple animations. This approach allows you to manage all the character's animations in one place and simplifies the process of transitioning between different actions.

    To achieve this, you can use a state machine within your animation controller. Each animation, such as "Open door," "Drink beer," or "Put a radio on," can be represented as a state within the state machine. Transitions between states can be triggered based on specific conditions or user input.

    By using a state machine, you can easily control the character's animations and smoothly transition between different actions. This approach also provides flexibility if you want to add or modify animations later on.

    Creating a separate animation controller for each individual animation can quickly become cumbersome and difficult to manage. It can lead to redundancy and unnecessary complexity in your project.

    In summary, using a single animation controller with a state machine to manage different animations for your character is generally the preferred approach for efficiency and organization.