Unity2d 关卡开始提示

创建一个UI文本

绑定如下脚本

指定这个文本

开始游戏后3秒自动消失

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class MissionShow: MonoBehaviour
{
    public GameObject MissionBar;
    private float showTimer=3;
    // Start is called before the first frame update
    void Awake()
    {
        MissionBar.SetActive(true);
    }

    // Update is called once per frame
    void Update()
    {
        showTimer -= Time.deltaTime;
        if (showTimer < 0)
        {
            MissionBar.SetActive(false);
        }
    }
}

附完整教程:

Unity2d Rubys Adventure 课程设计报告

猜你喜欢

转载自blog.csdn.net/weixin_43673589/article/details/106559264
今日推荐