Skip to content
Snippets Groups Projects
Select Git revision
  • a725d7ba0bf83c1195fe415699eda99e3c662967
  • main default
  • master
  • tempAndrToMaster
4 results

DropHandling.cs

Blame
  • DropHandling.cs 518 B
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using UnityEngine.EventSystems;
    
    public class DropHandling : MonoBehaviour, IDropHandler 
    {
        GameObject current;
        public void OnDrop(PointerEventData eventData){
            Debug.Log(eventData.pointerDrag + "was dropped on "+ gameObject.name);
            Destroy(current);
            current = Instantiate(eventData.pointerDrag,Vector3.zero, Quaternion.identity);
            current.transform.SetParent(gameObject.transform, false);
        }
    
    }