Tanoda
ObjectDroppedEvent.cs
Go to the documentation of this file.
1using System.Collections;
2using System.Collections.Generic;
3using GILES.Interface;
4using UnityEngine;
5using UnityEngine.UI;
6
7public class ObjectDroppedEvent : MonoBehaviour
8{
9 public Text NameText;
10
11 private float lastDropEvent = -5f;
12 void OnSimpleDragAndDropEvent(DragAndDropCell.DropEventDescriptor desc)
13 {
14 if (lastDropEvent + 1 > Time.time)
15 {
16 return;
17 }
18
19 lastDropEvent = Time.time;
20
21 GetComponent<GameObjectPreview>().asset = desc.item.gameObject.GetComponent<pb_PrefabBrowserItemButton>().asset;
22 NameText.text = desc.item.gameObject.GetComponent<pb_PrefabBrowserItemButton>().asset.name;
23 if (GetComponent<GameObjectPreview>().enabled)
24 {
25 GetComponent<GameObjectPreview>().ReInitialize();
26 }
27 GetComponent<GameObjectPreview>().enabled = true;
28 desc.permission = false;
29 }
30}
Every item's cell must contain this script