public void OnEndDrag(PointerEventData eventData) { if (_isDragged) { _isDragged = false; var r = new List <RaycastResult>(); EventSystem.current.RaycastAll(eventData, r); ChatDockUI newDock = null; for (int i = 0; i < r.Count; i++) { var dock = r[i].gameObject.GetComponent <ChatDockUI>(); if (dock != null) { newDock = dock; break; } } if (newDock == null && ChatUI.Instance.FloatingDockPrefab != null) { newDock = Instantiate(ChatUI.Instance.FloatingDockPrefab); newDock.transform.SetParent(canvas.transform, false); newDock.rectTransform.localPosition = GetUIMousePosition(); } if (newDock != null) { ChannelUI.ChatDockUI.Undock(ChannelUI); newDock.Dock(ChannelUI); } else { transform.SetParent(ChannelUI.ChatDockUI.DockToolbar.transform, true); } } else { scrollRect.OnEndDrag(eventData); } }