I ran into the same thing in a system that tries to reset all layers to their default state. Ended up needing to make an array that the user has to use to manually specify which layers to reset, which is annoyingly pointless from the perspective of users.
There are a lot of stupid things like this in Animator Controllers that either log an error without an exception the caller can catch or even worse, just silently fail to do what you want (like calling Play twice in the same frame simply ignores the second call).
But yeah, probably no one’s working on it because they’re making a new animation system for DOTS. And given the general direction of DOTS (“performance by default” instead of “easy development by default”) I fully expect them to come up with yet another poorly designed animation system.
For those who are looking for how to do this here is an editor only solution to get an array of layer sync flags:
public bool[] GetSynchronizedLayerFlags(Animator animator)
{
var runtimeController = animator.runtimeAnimatorController;
if(runtimeController == null)
{
Debug.LogErrorFormat("RuntimeAnimatorController must not be null.");
return;
}
if (runtimeController is AnimatorOverrideController overrideController)
{
runtimeController = overrideController.runtimeAnimatorController;
}
var controller = runtimeController as UnityEditor.Animations.AnimatorController;
if(controller == null)
{
Debug.LogErrorFormat("AnimatorController must not be null.");
return;
}
var synchronizedLayers = new bool[controller.layers.Length];
for (var index = 0; index < controller.layers.Length; index++)
{
synchronizedLayers[index] = (uint) controller.layers[index].syncedLayerIndex <
(uint) controller.layers.Length;
}
return synchronizedLayers;
}