项目中有些信息需要以Toast的形式体现出来,不需要交互,弹出后一段时间后消失,多个Toast会向上重叠,下面是一个UGUI Toast的实现,动画部份用到了Dotween来实现 首先需要制作Toast预制体,预制体初始化后就进行淡出动画,初始化的过程中根据str长度改变父节点图片大小 using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using
Toast吐司: Toast内容简单,不做过多介绍,Toast支持自带简单吐司,自定义吐司.内容简单可见代码,详见API.A toast provides simple feedback about an operation in a small popup. It only fills the amount of space required for the message and the current activity remains visible and interactive. Fo
using UnityEngine; using System.Collections; using UnityEngine.EventSystems; public class EventTriggerListener : UnityEngine.EventSystems.EventTrigger{ public delegate void VoidDelegate (GameObject go); public VoidDelegate onClick; public VoidDelegat