我正在创建一个游戏,我想在玩家死亡时显示一个面板
我尝试了不同的方法,但似乎没有一个能做我想做的
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)