[TUTORIAL] CARREGAR CENA APÓS UM TEMPO UNITY 4.7
Página 1 de 1
[TUTORIAL] CARREGAR CENA APÓS UM TEMPO UNITY 4.7
- Código:
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class Script : MonoBehaviour {
public float TempoFixoIncial = 0;
public float TempoFixoFinal = 10;
public Button ;
public GameObject ProxCenabutton2;
// Use this for initialization
void Start () {
ProxCenabutton2.SetActive(false);
}
// Update is called once per frame
void Update () {
TempoFixo +=(1*Time.deltaTime);
ProxCenaButton1.onClick = new Button.ButtonClickedEvent();
ProxCenaButton1.onClick.AddListener(() => NextScene());
if(TempoFixo > TempoFixoFinal ){
ProxCenabutton2.SetActive(true);
}
}
public void Jogar(){
Application.LoadLevel("OnomeDaProximaCenaAqui");
}
}
A CENA CARREGA APÓS 10 SEGUNDOS, VOCÊ PODE MUDAR EM TEMPOFIXOFINAL.
script parar mudar a cena pós um tempo caso voce use o unity 4.7 como eu.
Basta criar um GameObject vazio e colocar a script.
Criar um botão que cobre toda a Canvas, remova a textura dele, deixe ele invisivel.
e quando passar o tempo, você pode clicar na tela e ele joga você na porxima cena.
caso queira colocar um texto para saber quando o tempo passou :
- Código:
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class Script : MonoBehaviour {
public float TempoFixoIncial = 0;
public float TempoFixoFinal = 10;
public Button ;
public GameObject ProxCenabutton2;
// Use this for initialization
void Start () {
ProxCenabutton2.SetActive(false);
texto.SetActive(false);
}
// Update is called once per frame
void Update () {
TempoFixo +=(1*Time.deltaTime);
ProxCenaButton1.onClick = new Button.ButtonClickedEvent();
ProxCenaButton1.onClick.AddListener(() => NextScene());
if(TempoFixo > TempoFixoFinal ){
texto.SetActive(true);
ProxCenabutton2.SetActive(true);
}
}
public void Jogar(){
Application.LoadLevel("OnomeDaProximaCenaAqui");
}
}
TruffleDevelop- Iniciante
- PONTOS : 2261
REPUTAÇÃO : 1
Áreas de atuação : modelagem,programação,design.
Respeito as regras :
Tópicos semelhantes
» Carregar Cena após determinado tempo
» [TUTORIAL] Como carregar uma cena em segundo plano?
» Erro ao carregar a cena no Unity 2018
» [TUTORIAL] Evitar Sombras ULTRA escuras após trocar de cena
» [TUTORIAL] Ressetar parametros do Animator após executar animação ( Unity 5 )
» [TUTORIAL] Como carregar uma cena em segundo plano?
» Erro ao carregar a cena no Unity 2018
» [TUTORIAL] Evitar Sombras ULTRA escuras após trocar de cena
» [TUTORIAL] Ressetar parametros do Animator após executar animação ( Unity 5 )
Página 1 de 1
Permissões neste sub-fórum
Não podes responder a tópicos