Приведенные выше ответы портят мою камеру или что-то в этом роде. Итак, я сделал свой собственный код, основанный на ответах (который вставлен ниже) (опубликовать его для использования в будущем). Спасибо всем, кто ответил.
using UnityEngine;
using UnityEngine.SceneManagement;
using System.Collections;
public class GameManager : MonoBehaviour
{
public float restarttimer = 3f;
public GameObject Ninja;
public GameObject Covid;
public GameObject[] Buttons;
public GameObject[] Ground;
public GameObject[] HP;
public GameObject[] panelgo;
void Start()
{
//Ninja
Debug.Log("Generating Hero");
Ninja.SetActive(true);
//enemy
Debug.Log("Generating Enemy");
Covid.SetActive(true);
//ground
Debug.Log("Generating Ground");
foreach (GameObject tagged in Ground)
{
tagged.SetActive(true); // or true
}
//HP
foreach (GameObject tagged in HP)
{
tagged.SetActive(true); // or true
}
//Buttons
foreach (GameObject tagged in Buttons)
{
tagged.SetActive(true); // or true
}
//GameOver
foreach (GameObject tagged in panelgo)
{
tagged.SetActive(false); // or true
}
}
public void GameOver()
{
Ninja.SetActive(false);
Covid.SetActive(false);
foreach (GameObject tagged in Ground)
{
tagged.SetActive(false); // or true
}
foreach (GameObject tagged in HP)
{
tagged.SetActive(false); // or true
}
foreach (GameObject tagged in Buttons)
{
tagged.SetActive(false); // or true
}
foreach (GameObject tagged in panelgo)
{
tagged.SetActive(true); // or true
}
}
public void buttonrestart()
{
Invoke("restart", restarttimer);
}
public void restart()
{
SceneManager.LoadScene(SceneManager.GetActiveScene().name);
}
}
PS COVID Смешное имя для врага;) ------------------- ЗАВЕРШЕНА НИТЯ ---------- ----------------