static private GetDragAndDropObjects ( int draggedInstanceID, List |
||
draggedInstanceID | int | |
selectedInstanceIDs | List |
|
Résultat | Object[] |
public override void StartDrag(TreeViewItem draggedItem, List <int> draggedItemIDs) { DragAndDrop.PrepareStartDrag(); if ((Event.current.control || Event.current.command) && !draggedItemIDs.Contains(draggedItem.id)) { draggedItemIDs.Add(draggedItem.id); } // Ensure correct order for hierarchy items (to preserve visible order when dropping at new location) draggedItemIDs = m_TreeView.SortIDsInVisiblityOrder(draggedItemIDs); if (!draggedItemIDs.Contains(draggedItem.id)) { draggedItemIDs = new List <int> { draggedItem.id } } ; Object[] draggedObjReferences = ProjectWindowUtil.GetDragAndDropObjects(draggedItem.id, draggedItemIDs); DragAndDrop.objectReferences = draggedObjReferences; // After introducing multi-scene, UnityEngine.Scene can be selected in HierarchyWindow. // UnityEngine.Scene is not a UnityEngine.Object. // So DragAndDrop.objectReferences can't cover this case. List <Scene> draggedScenes = GetDraggedScenes(draggedItemIDs); if (draggedScenes != null) { DragAndDrop.SetGenericData(kSceneHeaderDragString, draggedScenes); List <string> paths = new List <string>(); foreach (Scene scene in draggedScenes) { if (scene.path.Length > 0) { paths.Add(scene.path); } } DragAndDrop.paths = paths.ToArray(); } string title; if (draggedItemIDs.Count > 1) { title = "<Multiple>"; } else { if (draggedObjReferences.Length == 1) { title = ObjectNames.GetDragAndDropTitle(draggedObjReferences[0]); } else if (draggedScenes != null && draggedScenes.Count == 1) { title = draggedScenes[0].path; } else { title = "Unhandled dragged item"; Debug.LogError("Unhandled dragged item"); } } DragAndDrop.StartDrag(title); dataSource.SetupChildParentReferencesIfNeeded(); } GameObjectTreeViewDataSource dataSource { get { return((GameObjectTreeViewDataSource)m_TreeView.data); } }