效果图
点击计时->再关闭面板->再次点击计时->发现时间继续上次的计算



在PopupPanelController的脚本中重写其基类的OnEnter和Onexit方法
PopupPanelController.cs:
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using DG.Tweening;
public class PopupPanelController : NBasePanel {
private Text text;
private float startTime;
private float curTime;
private float exitTime = 0;
private void Awake()
{
text = transform.Fi

本文介绍了如何在Unity游戏或应用中,通过自定义PopupPanelController脚本来实现面板的计时功能,包括OnEnter和OnExit方法的重写,确保时间连续计数。重点在于理解虚函数、override的使用以及UI组件的更新逻辑。
最低0.47元/天 解锁文章

被折叠的 条评论
为什么被折叠?



