private static void ProcessDragEvent(Event dragEvent, SceneView sceneView) { if (dragEvent != null && (dragEvent.type == EventType.DragUpdated || dragEvent.type == EventType.DragPerform)) { bool dragHDAs = false; List <string> hdaList = new List <string>(); foreach (string file in DragAndDrop.paths) { if (HEU_HAPIUtility.IsHoudiniAssetFile(file)) { dragHDAs = true; DragAndDrop.visualMode = DragAndDropVisualMode.Move; hdaList.Add(file); break; } } if (dragHDAs) { if (dragEvent.type == EventType.DragPerform) { if (HEU_SessionManager.ValidatePluginSession()) { Vector3 dropPos = Vector3.zero; if (sceneView != null) { Camera camera = sceneView.camera; Vector3 mousePos = HEU_EditorUI.GetMousePosition(ref dragEvent, camera); Ray ray = camera.ScreenPointToRay(mousePos); ray.origin = camera.transform.position; Plane plane = new Plane(); plane.SetNormalAndPosition(Vector3.up, Vector3.zero); float enter = 0f; plane.Raycast(ray, out enter); enter = Mathf.Clamp(enter, camera.nearClipPlane, camera.farClipPlane); dropPos = ray.origin + ray.direction * enter; } List <GameObject> createdGOs = new List <GameObject>(); foreach (string file in hdaList) { GameObject go = HEU_HAPIUtility.InstantiateHDA(file, dropPos, HEU_SessionManager.GetOrCreateDefaultSession(), true); if (go != null) { createdGOs.Add(go); } } // Select the created assets HEU_EditorUtility.SelectObjects(createdGOs.ToArray()); } } dragEvent.Use(); } } }