- Home /
Draggable UI image panel is not being dragged when parented to another panel?
I'm following this tutorial: https://www.youtube.com/watch?v=P66SSOzCqFU
For whatever reason when I make my object a child of the panel it loses the ability to be dragged.
My code for the drag script is this:
using UnityEngine;
using System.Collections;
using UnityEngine.EventSystems;
public class Draggable : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDragHandler {
#region IBeginDragHandler implementation
public void OnBeginDrag (PointerEventData eventData)
{
Debug.Log ("OnBeginDrag");
}
#endregion
#region IDragHandler implementation
public void OnDrag (PointerEventData eventData)
{
Debug.Log (this.transform.position);
this.transform.position = eventData.position;
}
#endregion
#region IEndDragHandler implementation
public void OnEndDrag (PointerEventData eventData)
{
Debug.Log ("OnEndDrag");
}
#endregion
}
There are no scripts on the parent panel. Just a horizontal layout component like in the tutorial.
Also when any draggable object is dragged and placed into the panel, it no longer becomes draggable.
Comment
Your answer
Follow this Question
Related Questions
Drag Panel using Buttons 1 Answer
How to drag around an object and making it collide with other object 2D 2 Answers
Draggable handles 0 Answers
Disable slider dragging at specified value 3 Answers
NGUI: Draggable popup list 0 Answers