using System.Collections; using System.Collections.Generic; using UnityEngine; using DG.Tweening; public class MoveUI : MonoBehaviour { [Header("ui初始位置和目标位置")] [SerializeField] private Vector3 endpos; private Vector3 startpos; void Start() { startpos = transform.localPosition; } /// /// 放出 /// public void Release() { UImove(startpos); } /// /// 收起 /// public void Collapse() { UImove(endpos); } /// /// 实现UI移入移出 /// /// 目标位置 public void UImove(Vector3 pos) { transform.DOLocalMove(pos, 1); } }