private void OnGUI() { EditorGUILayout.BeginHorizontal(); controller = (AnimatorController)EditorGUILayout.ObjectField("Controller", controller, typeof(AnimatorController), false); EditorGUILayout.EndHorizontal(); if (controller == null) { return; } selectedLayers = EditorGUILayout.MaskField( "Target Layer", selectedLayers, controller.layers.Select(x => x.name).ToArray()); tryCount = EditorGUILayout.IntField("計算回数", tryCount); if (GUILayout.Button("均等に並べる")) { foreach (var layer in TakeLayers(selectedLayers)) { if (layer >= controller.layers.Length) { break; } LayoutHelper.GridLayout(controller.layers[layer].stateMachine); } EditorUtility.SetDirty(controller); AssetDatabase.SaveAssets(); } k = EditorGUILayout.FloatField("ばね係数", k); naturalLength = EditorGUILayout.FloatField("ばねの自然長", naturalLength); repulsivePower = EditorGUILayout.FloatField("斥力", repulsivePower); threshold = EditorGUILayout.FloatField("斥力の効果範囲", threshold); if (GUILayout.Button("配置する")) { foreach (var layer in TakeLayers(selectedLayers)) { if (layer >= controller.layers.Length) { break; } LayoutHelper.Align(controller.layers[layer].stateMachine, tryCount, k, naturalLength, repulsivePower, threshold); } EditorUtility.SetDirty(controller); AssetDatabase.SaveAssets(); } }