Script de sélection multiple
Le site Bydesigngames a mis en ligne un script dédié à l’éditeur d’Unity qui va vous donner la possibilité de placer plusieurs objets dans un même calque.
Dans le menu, il suffira de faire option Tools->Move selection to layer.
?Download MultipleObjectsToLayer.cs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | using UnityEngine; using UnityEditor; public class MultipleObjectsToLayer : EditorWindow { static int selection = 0; static bool includeChildren = true; [MenuItem ("Tools/Move selection to layer %&l")] public static void Run () { if (Selection.gameObjects.Length > 0) { GetWindow (typeof (MultipleObjectsToLayer)).Show (); } } void OnGUI () { GUILayout.Label ("Move selection to layer", EditorStyles.boldLabel); includeChildren = GUILayout.Toggle(includeChildren, "Include children"); selection = EditorGUILayout.LayerField(selection); if (GUILayout.Button("Move to layer")) { MoveSelectionToLayer(); } } static void MoveSelectionToLayer() { Object[] selectedObjects; if (includeChildren) { selectedObjects = Selection.GetFiltered(typeof(GameObject), SelectionMode.Deep); } else { selectedObjects = Selection.GetFiltered(typeof(GameObject), SelectionMode.TopLevel); } foreach (GameObject go in selectedObjects) { go.layer = selection; } } } |