- Home /
Question by
insomniaunleashed · Mar 07, 2018 at 09:54 PM ·
animator controller
why does an ChildAnimatorState position property not accept a new value
hi guys
hope someone can help, after programatically creating animator states in my current project, i wanted the animator states created to be sorted into multiple columns, the odd thing is that the entry,any state & exit allow repositioning but the actual animatorstates/animatorstatemachines ignore the setting of the position property.
consder the following code
const float SEPERATION = 100f;
Vector3 col1 = new Vector3(0, 0, 0);
Vector3 col2 = new Vector3(SEPERATION * 2, 0, 0);
Vector3 col3 = new Vector3(SEPERATION * 4, 0, 0); var Parent = GetComponent<Animator>().runtimeAnimatorController.layers[0].stateMachine;
// align the entry states in column 1 (working)
Parent.entryPosition = col1; col1.y += SEPERATION;
Parent.anyStatePosition = col1; col1.y += SEPERATION;
// align the created states in column 2 (not working)
for (int i = 0; i < Parent.stateMachines.Length; i++)
{
Parent.stateMachines[i].position = col2;
col2.y += SEPERATION;
}
// align the exit states in column 3 (working)
Parent.exitPosition = col3; col3.y += SEPERATION;
any thoughts on why the position property inspite of having set just plain ignores the value, is there a way to align the animator states, this is an editor tool not runtime.
Comment
Your answer