using UnityEngine;
using System.Collections;
[AddComponentMenu("NGUI/Examples/Drag and Drop Item (Example)")]
public class ExampleDragDropItem : UIDragDropItem
{
public string path;
protected override void OnDragDropRelease (GameObject surface)
{
if (surface != null)
{
ExampleDragDropSurface dds = surface.GetComponent<ExampleDragDropSurface>();
if (dds != null)
{
GameObject child = NGUITools.AddChild(dds.gameObject, Resources.Load(path));
Transform trans = child.transform;
trans.position = UICamera.lastHit.point;
if (dds.rotatePlacedObject)
{
trans.rotation = Quaternion.LookRotation(UICamera.lastHit.normal) * Quaternion.Euler(90f, 0f, 0f);
}
}
}
base.OnDragDropRelease(surface);
}
}