小编Sin*_*rge的帖子

有没有办法检查游戏对象是否已被销毁?

我正在创建一个游戏,我想在玩家死亡时显示一个面板

我尝试了不同的方法,但似乎没有一个能做我想做的

using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class DeadOrAlive : MonoBehaviour
{

    public GameObject Player;
    public GameObject deadPanel;

    void Update()
    {
        if (!GameObject.FindWithTag("Player"))
        {
            deadPanel.SetActive(true);
        }
    }


}
Run Code Online (Sandbox Code Playgroud)

c# game-development unity-game-engine

0
推荐指数
1
解决办法
2550
查看次数

标签 统计

c# ×1

game-development ×1

unity-game-engine ×1