Default Layer Index for AnimatorPlay Sequencer comand

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
laskeys0824
Posts: 1
Joined: Thu May 05, 2022 5:46 pm

Default Layer Index for AnimatorPlay Sequencer comand

Post by laskeys0824 »

Hello
I am currently using Unity 2021.1.12f1 and Dialgoue System V2.2.23(Ed version) I noticed that I was getting a warning in the console about an Invalid Layer Index '-1'. This caused my animation to not play unless I manually specified the layer that the animation was on. I checked the documentation and the default parameter for the layer is -1. Does it make sense to change the default value for this parameter?
Thanks
User avatar
Tony Li
Posts: 21977
Joined: Thu Jul 18, 2013 1:27 pm

Re: Default Layer Index for AnimatorPlay Sequencer comand

Post by Tony Li »

Hi,

Usually the Invalid Layer Index '-1' occurs when the Animator can't find the named state in any layer.

From the Unity API documentation: "If layer is -1, it plays the first state with the given state name or hash."

The default for AnimatorPlay() is to specify layer -1 so it can find the named state regardless of what layer it's in.
Post Reply