/
darov
/
Platformer
Обзор
Документация
Войти
/
darov
/
Platformer
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
Assets/Scripts/SceneNavigator.cs
29 строк
756 B
Roman Danilov
comment
15 окт 2025, 07:53
15 окт 2025, 07:53
80f1cc3
Код
Авторство
О чём код?
using System.Collections; using UnityEngine; using UnityEngine.SceneManagement; public class SceneNavigator : MonoBehaviour { public void OnLevelSelectButton(int scene) { StartCoroutine(WaitAndLoadScene(scene)); } public void OnRestartButton() { int activeScene = SceneManager.GetActiveScene().buildIndex; StartCoroutine(WaitAndLoadScene(activeScene)); } public void OnNextButton() { int activeScene = SceneManager.GetActiveScene().buildIndex; StartCoroutine(WaitAndLoadScene(++activeScene)); } private IEnumerator WaitAndLoadScene(int scene) { yield return new WaitForSeconds(0.2f); SceneManager.LoadScene(scene); } }