Страница 1 из 1

новая сцена

СообщениеДобавлено: 27 фев 2019, 21:53
tolezen
как сделать переход на другую сцену с задержкой?
вот код

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

public class buttons : MonoBehaviour

{
public float timer = 5.0f;
public GameObject clickup;

private void OnMouseDown()
{
GetComponent<AudioSource>().Play();
transform.localScale = new Vector3(1.4f, 1.4f, 1.4f);
}
private void OnMouseUp()
{

timer -= Time.deltaTime;
if (timer <= 0)
{
SceneManager.LoadScene("game", LoadSceneMode.Single);
}
transform.localScale = new Vector3(1.0f, 1.0f, 1.0f);




}
}

Re: новая сцена

СообщениеДобавлено: 27 фев 2019, 22:34
Saltant
Сделай с помощью AsyncOperation https://docs.unity3d.com/ScriptReferenc ... ation.html а именно с помощью свойства allowSceneActivation