Unity UI拖拽优化

    技术2023-06-30  63

    1.之前的拖拽都是直接拖拽图片 2.现在可以添加一个层,拖拽哪个图片在该层实时实例化一个对相应的图片即可,然后使图片跟随鼠标移动。 这样原始图片就不需要移动。

    脚本准备: 1.DragItem.cs 该脚本挂预制件元素中,用来实际处理拖拽操作。

    using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.EventSystems; public class DragItem : Mon
    Processed: 0.011, SQL: 9