![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
UGUI
goGogoiii
这个作者很懒,什么都没留下…
展开
-
UGUI:拖动UI物体实例化物体
using System.Collections;using System.Collections.Generic;using UnityEngine;using UnityEngine.EventSystems;public class Drag : MonoBehaviour, IDragHandler, IEndDragHandler, IBeginDragHandler{ //要复制的物体 public GameObject gobj; pub...原创 2020-05-20 16:37:41 · 630 阅读 · 5 评论 -
UGUI学习:面板倾斜
using System.Collections;using System.Collections.Generic;using UnityEngine;public class TiltPanel : MonoBehaviour{ public Vector2 range = new Vector2(5f, 3f); Transform mTrans; Qua...原创 2020-04-30 14:48:40 · 524 阅读 · 0 评论 -
UGUI学习:拖拽控制面板大小
using System.Collections;using System.Collections.Generic;using UnityEngine;using UnityEngine.EventSystems;public class ResizePanel : MonoBehaviour, IDragHandler, IPointerDownHandler{ ...原创 2020-04-30 13:59:52 · 255 阅读 · 0 评论 -
UGUI学习:抓取和放入替换图片
效果:抓取的图片注:PointerEventData.pointerEnter当前触发OnPointerEnter的对象,一般鼠标移动到ui上的时候会触发这个事件,对应的是OnPointerExit,鼠标移出的时候using System.Collections;using System.Collections.Generic;using UnityEngine;us...原创 2020-04-30 09:57:32 · 373 阅读 · 0 评论 -
UGUI案例篇——页面滑动
在Canvas下创建ScrollView脚本声明的数据:using System.Collections;using System.Collections.Generic;using UnityEngine;using UnityEngine.UI;using UnityEngine.EventSystems;using DG.Tweening;public c...原创 2019-10-13 22:23:49 · 313 阅读 · 1 评论 -
UGUI案例篇——解决UI和3D物体之间的事件响应问题
(一)解决UI和3D物体层叠时,只响应UI的问题创建一个Cube和一个Image对Cube加入脚本:using System.Collections;using System.Collections.Generic;using UnityEngine;public class CubeOnClick : MonoBehaviour,IPointerClickHandler...原创 2019-10-01 16:36:55 · 454 阅读 · 0 评论 -
UGUI案例篇——使用2D图片制作3D轮转图
最后的两个代码段为最终代码,可直接使用(需导入DoTween)对数据的设置(参考):,先创建物体模板,再创建物体设置图片的缩放系数和X轴位置,再对其位置信息进行计算:using System.Collections;using System.Collections.Generic;using UnityEngine;using UnityEngine.UI;publ...原创 2019-10-04 00:26:47 · 957 阅读 · 9 评论