D
D
DANICH702021-01-23 12:45:06
Unity
DANICH70, 2021-01-23 12:45:06

Go to next. stage?

I wrote the correct code, when I collided with the circle (it's on the screen), the scene switched. But nothing happens.
The code:

using UnityEngine;
using System.Collections;
using UnityEngine.SceneManagement;

public class Destroy : MonoBehaviour
{
    public GameObject explosion; //игровой объект для взрыва астеройда
    public GameObject playerExplosion; //игровой объект для взрыва корабля игрока

    void OnTriggerEnter(Collider other)
    {
        Instantiate(explosion, transform.position, transform.rotation); //создание взрыва при уничтожении астеройда
        if (other.tag == "Player")
        {   
            SceneManager.LoadScene("Main_Menu");
        }
        Destroy(gameObject);
        Destroy(other.gameObject);
    }
}


Screen:600bf01de6c07005590810.png

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question