Selection 可以获取一切选中的物体 比如将所有动画状态进行全连接
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| [MenuItem("SelectTools/GetSelection")] static void GetSelection() { Object[] objects = Selection.objects; List<AnimatorState> states=new List<AnimatorState>(); foreach(var obj in objects) { if (obj.GetType() == typeof(AnimatorState)) { states.Add(obj as AnimatorState); } }
for(int i = 0; i < states.Count; ++i) { for(int j = i + 1; j < states.Count; ++j) { states[i].AddTransition(states[j]); states[j].AddTransition(states[i]); } } }
|