I have two characters (enemy) having the same Animator Controller and they play animations Simultaneously. The timing for their animations is exactly the same. Is there a way I
The issue here is that even if you access the correct instance of the Animator
they all still share the same AnimatorController
asset.
=> You need a separate individual AnimatorControllers
for each instance of the animator.
You can create them for each instance on runtime e.g. using
[RequrieComponent(typeof(Animator))]
public class AnimatorControllerCloner : MonoBehaviour
{
[SerializeField] private Animator _animator;
private void Start()
{
if(!_animator) _animator = GetComponent<Animator>();
var runtimeController = _animator.runtimeAnimatorController;
var newController = Instantiate(runtimeController);
_animator.runtimeAnimatorController = newController;
}
}