jump-game/Jump Game/Assets/Scripts/Menu/ChangeScene.cs
2020-04-30 00:04:48 +03:00

29 lines
673 B
C#

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class ChangeScene : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
if(SceneManager.GetActiveScene().buildIndex == 1)
{
StartCoroutine(ChangeSceneToGame(2));
}
if(SceneManager.GetActiveScene().buildIndex == 3)
{
StartCoroutine(ChangeSceneToGame(0));
}
}
private IEnumerator ChangeSceneToGame(int index)
{
yield return new WaitForSeconds(5);
SceneManager.LoadScene(index);
}
}